phpDocumentor default
[ class tree: default ] [ index: default ] [ all elements ]

Procedural File: sqlparser.lib.php

Source Location: /lodel/scripts/pma/sqlparser.lib.php

Page Details
Includes
include ('./libraries/sqlparser.data.php') [line 58]

Include data for the SQL Parser

[ Top ]

include ('./libraries/string.lib.php') [line 51]

Include the string library as we use it heavily

[ Top ]


Constants
PMA_SQP_LIB_INCLUDED  [line 36]

PMA_SQP_LIB_INCLUDED = 1

SQL Parser Functions for phpMyAdmin

Copyright 2002 Robin Johnson <robbat2@users.sourceforge.net> http://www.orbis-terrarum.net/?l=people.robbat2

These functions define an SQL parser system, capable of understanding and extracting data from a MySQL type SQL query.

The basic procedure for using the new SQL parser: On any page that needs to extract data from a query or to pretty-print a query, you need code like this up at the top:

($sql contains the query) $parsed_sql = PMA_SQP_parse($sql);

If you want to extract data from it then, you just need to run $sql_info = PMA_SQP_analyze($parsed_sql);

lem9: See comments in PMA_SQP_analyze for the returned info from the analyzer.

If you want a pretty-printed version of the query, do: $string = PMA_SQP_formatHtml($parsed_sql); (note that that you need to have syntax.css.php included somehow in your page for it to work, I recommend '<link rel="stylesheet" type="text/css" href="syntax.css.php" />' at the moment.)


[ Top ]


Functions
PMA_SQP_analyze  [line 667]

array PMA_SQP_analyze( array $arr  )

Analyzes SQL queries

Parameters:
array   $arr:  The SQL queries

API Tags:
Return:  The analyzed SQL queries
Access:  public


[ Top ]
PMA_SQP_arrayAdd  [line 62]

void PMA_SQP_arrayAdd( &$arr, $type, $data, &$arrsize  )
Parameters:
   &$arr: 
   $type: 
   $data: 
   &$arrsize: 


[ Top ]
PMA_SQP_bug  [line 156]

void PMA_SQP_bug( string $message, string $sql  )

Do display the bug report

Parameters:
string   $message:  The error message
string   $sql:  The failing SQL query

API Tags:
Access:  public


[ Top ]
PMA_SQP_buildCssData  [line 1968]

string PMA_SQP_buildCssData( )

Builds CSS rules used for html formatted SQL queries


API Tags:
Return:  The CSS rules set
Global:  array $cfg: The current PMA configuration
See:  PMA_SQP_buildCssRule()
Access:  public


[ Top ]
PMA_SQP_buildCssRule  [line 1945]

string PMA_SQP_buildCssRule( string $classname, string $property, string $value  )

Builds a CSS rule used for html formatted SQL queries

Parameters:
string   $classname:  The class name
string   $property:  The property name
string   $value:  The property value

API Tags:
Return:  The CSS rule
See:  PMA_SQP_buildCssData()
Access:  public


[ Top ]
PMA_SQP_formatHtml  [line 1575]

string PMA_SQP_formatHtml( array $arr, [string $mode = 'color'], [integer $start_token = 0], [integer $number_of_tokens = -1]  )

Formats SQL queries to html

Parameters:
array   $arr:  The SQL queries
string   $mode:  mode
integer   $start_token:  starting token
integer   $number_of_tokens:  number of tokens to format, -1 = all

API Tags:
Return:  The formatted SQL queries
Access:  public


[ Top ]
PMA_SQP_formatHtml_colorize  [line 1545]

array PMA_SQP_formatHtml_colorize( array $arr  )

Colorizes SQL queries html formatted

Parameters:
array   $arr:  The SQL queries html formatted

API Tags:
Return:  The colorized SQL queries
Access:  public


[ Top ]
PMA_SQP_formatNone  [line 1993]

string PMA_SQP_formatNone( array $arr  )

Gets SQL queries with no format

Parameters:
array   $arr:  The SQL queries list

API Tags:
Return:  The SQL queries with no format
Access:  public


[ Top ]
PMA_SQP_formatText  [line 2011]

string PMA_SQP_formatText( array $arr  )

Gets SQL queries in text format

Parameters:
array   $arr:  The SQL queries list

API Tags:
Return:  The SQL queries in text format
Access:  public


[ Top ]
PMA_SQP_getErrorString  [line 100]

string PMA_SQP_getErrorString( )

Get the contents of the error variable for the SQL parser


API Tags:
Return:  Error string from SQL parser
Access:  public


[ Top ]
PMA_SQP_isError  [line 113]

boolean PMA_SQP_isError( )

Check if the SQL parser hit an error


API Tags:
Return:  error state
Access:  public


[ Top ]
PMA_SQP_parse  [line 207]

mixed PMA_SQP_parse( string $sql  )

Parses the SQL queries

Parameters:
string   $sql:  The SQL query list

API Tags:
Return:  Most of times, nothing...
Global:  integer 8: MySQL function names count
Global:  array $cfg$PMA_SQPdata_column_attrib: The current PMA configuration
Global:  array $PMA_SQPdata_reserved_word: MySQL column attributes
Global:  array $PMA_SQPdata_column_type: MySQL reserved words
Global:  array $PMA_SQPdata_function_name: MySQL column types
Global:  array $PMA_SQPdata_column_attrib_cnt: MySQL function names
Global:  integer $PMA_SQPdata_reserved_word_cnt: MySQL column attributes count
Global:  integer $PMA_SQPdata_column_type_cnt: MySQL reserved words count
Global:  integer $PMA_SQPdata_function_name_cnt: MySQL column types count
Access:  public


[ Top ]
PMA_SQP_resetError  [line 86]

void PMA_SQP_resetError( )

Reset the error variable for the SQL parser


API Tags:
Access:  public


[ Top ]
PMA_SQP_throwError  [line 128]

void PMA_SQP_throwError( string $message, string $sql  )

Set an error message for the system

Parameters:
string   $message:  The error message
string   $sql:  The failing SQL query

API Tags:
Access:  private


[ Top ]
PMA_SQP_typeCheck  [line 641]

boolean PMA_SQP_typeCheck( string $toCheck, string $whatWeWant  )

Checks for token types being what we want...

Parameters:
string   $toCheck:  String of type that we have
string   $whatWeWant:  String of type that we want

API Tags:
Return:  result of check
Access:  private


[ Top ]


Documentation generated on Wed, 29 Aug 2007 14:30:02 +0200 by phpDocumentor 1.4.0a2