Add functions from help categories "Geometric feature" and "Functions and Modifiers for Use with GROUP BY". Always use names of root categories, as we don't need a tree structure here.

This commit is contained in:
Ansgar Becker
2007-07-06 21:29:47 +00:00
parent 5207ec37a7
commit fa46bd85c8
2 changed files with 964 additions and 269 deletions

View File

@ -21,8 +21,11 @@ while( $row = mysql_fetch_object($q) )
getfunctions($row->name); getfunctions($row->name);
} }
} }
getfunctions('Functions and Modifiers for Use with GROUP BY');
getfunctions('Geographic Features');
function getfunctions($cat)
function getfunctions( $cat, $rootcat='' )
{ {
global $nl, $fstruc, $fnames; global $nl, $fstruc, $fnames;
$q = mysql_query('HELP "'.$cat.'"'); $q = mysql_query('HELP "'.$cat.'"');
@ -30,7 +33,11 @@ function getfunctions($cat)
{ {
if( $row->is_it_category == 'Y' ) if( $row->is_it_category == 'Y' )
{ {
getfunctions( $row->name ); if( empty($rootcat) )
{
$rootcat = $cat;
}
getfunctions( $row->name, $rootcat );
} }
else else
{ {
@ -55,18 +62,18 @@ function getfunctions($cat)
$declaration = ''; $declaration = '';
$desc_cut = substr($rowdetails->description, 0, strpos($rowdetails->description,"\n\n")); $desc_cut = substr($rowdetails->description, 0, strpos($rowdetails->description,"\n\n"));
$df = preg_match('#Syntax:[^\(]*(\([^\)]*\))#Us', $desc_cut, $m2); $df = preg_match('#(Syntax:)?[^\(]*(\([^\)]*\))#Us', $desc_cut, $m2);
if( $df ) if( $df )
{ {
$declaration = $m2[1]; $declaration = $m2[2];
$declaration = str_replace("'", "''", $declaration ); $declaration = str_replace("'", "''", $declaration );
} }
$description = ''; $description = '';
$df = preg_match('#Syntax:.*\n\n(.+)$#Uis', $rowdetails->description, $m3); $df = preg_match('#(Syntax:)?.*\n\n(.+)$#Uis', $rowdetails->description, $m3);
if( $df ) if( $df )
{ {
$description = trim($m3[1]); $description = trim($m3[2]);
$description = preg_replace('#(\s+)#', ' ', $description ); $description = preg_replace('#(\s+)#', ' ', $description );
$description = str_replace(' o ', ' ', $description); $description = str_replace(' o ', ' ', $description);
$description = str_replace("'", "''", $description ); $description = str_replace("'", "''", $description );
@ -81,7 +88,7 @@ function getfunctions($cat)
." ),".$nl.$nl, ." ),".$nl.$nl,
$name, $name,
$declaration, $declaration,
$cat, (!empty($rootcat) ? $rootcat : $cat),
$description $description
); );
} }

File diff suppressed because it is too large Load Diff