Author: jstephens
Date: 2008-09-09 17:23:10 +0200 (Tue, 09 Sep 2008)
New Revision: 11743
Log:
Misc. changes/fixes
Modified:
trunk/dynamic-docs/command-optvars/ndb/errors/write-errors.php
Modified: trunk/dynamic-docs/command-optvars/ndb/errors/write-errors.php
===================================================================
--- trunk/dynamic-docs/command-optvars/ndb/errors/write-errors.php 2008-09-09 15:02:28 UTC (rev 11742)
+++ trunk/dynamic-docs/command-optvars/ndb/errors/write-errors.php 2008-09-09 15:23:10 UTC (rev 11743)
Changed blocks: 4, Lines Added: 79, Lines Deleted: 51; 4409 bytes
@@ -1,40 +1,35 @@
#!/usr/bin/php
<?php
-
- $errortypes = array();
+ $errortypes = array(
+ "NE" => "No error",
+ "AE" => "Application error",
+ "CE" => "Configuration or application error",
+ "ND" => "No data found",
+ "CV" => "Constraint violation",
+ "SE" => "Schema error",
+ "OE" => "Schema object already exists",
+ "UD" => "User defined error",
+ "IS" => "Insufficient space",
+ "TR" => "Temporary Resource error",
+ "NR" => "Node Recovery error",
+ "OL" => "Overload error",
+ "TO" => "Timeout expired",
+ "NS" => "Node shutdown",
+ "IT" => "Internal temporary",
+ "UR" => "Unknown result error",
+ "UE" => "Unknown error code",
+ "IE" => "Internal error",
+ "NI" => "Function not implemented"
+ );
+
+ $tags = array('', 'code', 'name', 'type', 'text');
+
# $errorfile = $argv[1] . '/storage/ndb/src/ndbapi/ndberror.c';
- $errorfile = 'ndb-error-short.c';
-/*
-
- # Target markup:
-
- <row>
- <entry>
- <errorcode>$1</errorcode>
- </entry>
- <entry>
- <errorname>$2</errorname>
- </entry>
- <entry>
- <errortype>$3</errortype>
- </entry>
- <entry>
- <errortext>$4</errortext>
- </entry>
- </row>
-*/
+ $errorfile = 'ndberror.c';
-/*
- $temp = $matches[2];
- $matches[2] = $matches[1];
- $matches[1] = $temp;
-*/
-
- $tags = array('', 'code', 'name', 'type', 'text');
-
function get_valid_lines($inputs)
{
$begin = FALSE;
@@ -108,12 +103,8 @@
{
global $tags;
- preg_match('/\{\s*(.*)\, (.*)\, (.*)\,\s?"(.*)"\s*\}\,?/', $line, $m);
+ preg_match('/\{\s*(.*)\,\s*(.*)\, (.*)\,\s?"(.*)"\s*\}\,?/', $line, $m);
- # $line = preg_replace("/\{(.+)\}\,?/", "$1", $line);
-
- # print_r($m);
-
$row = "
<row>
<entry><errorcode>{$m[1]}</errorcode></entry>
@@ -130,7 +121,7 @@
{
global $tags;
- preg_match('/\{\s*(.*)\, (.*)\, (.*)\,\s?"(.*)"\s*\}\,?/', $line, $m);
+ preg_match('/\{\s*(.*)\,\s*(.*)\, (.*)\,\s?"(.*)"\s*\}\,?/', $line, $m);
$c = count($m);
@@ -147,26 +138,63 @@
$output = "\n<row>";
foreach($array as $tag=>$value)
- $output .= "\n<entry><error$tag>$value</error$tag></entry>";
+ $output .= "\n <entry><error$tag>$value</error$tag></entry>";
return $output .= "\n</row>";
}
- $lines = get_valid_lines( array_map('trim', file($errorfile)) );
+/*
+ function test()
+ {
+ global $errorfile;
+
+ $lines = get_valid_lines( array_map('trim', file($errorfile)) );
+
+ echo "\nTesting get_valid_lines()...\n";
+ print_r($lines);
+
+ $errors = array();
+
+ echo "\nTesting lineToArray()...\n";
+ foreach($lines as $line)
+ $errors []= lineToArray($line);
+
+ print_r($errors);
+
+ echo "\nTesting arrayToXMLRow()...\n";
+ foreach($errors as $error)
+ echo arrayToXMLRow($error);
+ }
- echo "\nTesting get_valid_lines()...\n";
- print_r($lines);
+ test();
+*/
+ function test()
+ {
+ global $errorfile;
+ global $errortypes;
+
+ $lines = get_valid_lines( array_map('trim', file($errorfile)) );
+
+ $errors = array();
+
+ foreach($lines as $line)
+ $errors []= lineToArray($line);
+
+ foreach($errors as $error)
+ {
+ $type = trim($error['type']);
+ echo "$type\n";
+
+ $type = $errortypes[$type];
+ # $type = $error['type'];
+ echo "$type\n";
+
+ $error['type'] = $type;
+ }
+
+ print_r($errors);
+ }
- $errors = array();
-
- echo "\nTesting lineToArray()...\n";
- foreach($lines as $line)
- $errors []= lineToArray($line);
-
- print_r($errors);
-
- echo "\nTesting arrayToXMLRow()...\n";
- foreach($errors as $error)
- echo arrayToXMLRow($error);
+ test();
?>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r11743 - trunk/dynamic-docs/command-optvars/ndb/errors | jon | 9 Sep |