SQLParser Class Reference
[Db]

Class for parsing and executing statements in SQL files. More...

List of all members.

Public Member Functions

 executeFile ($file, $failOnError=true)
 getErrorMsg ()
parseStatements (&$sql)
 SQLParser ($driver, &$dataSource, $debug=false)
 stripComments (&$sql)

Public Attributes

 $commentDelim
 $dataSource
 $debug
 $driver
 $statementDelim


Detailed Description

Class for parsing and executing statements in SQL files.

Definition at line 18 of file SQLParser.inc.php.


Member Function Documentation

SQLParser.executeFile ( file,
failOnError = true 
)

Parse an SQL file and execute all SQL statements in it.

Parameters:
$file string full path to the file
$failOnError boolean stop execution if an error is encountered
Returns:
boolean true if no errors occurred, false otherwise

Definition at line 57 of file SQLParser.inc.php.

References parseStatements(), and stripComments().

SQLParser.getErrorMsg (  ) 

Return the last error message that occurred in parsing.

Returns:
string

Definition at line 143 of file SQLParser.inc.php.

& SQLParser.parseStatements ( &$  sql  ) 

Parse SQL content into individual SQL statements.

Parameters:
$sql string
Returns:
array

Definition at line 105 of file SQLParser.inc.php.

References String.regexp_match_all(), and String.substr_count().

Referenced by executeFile().

SQLParser.SQLParser ( driver,
&$  dataSource,
debug = false 
)

Constructor.

Parameters:
$driver string the database driver (currently only "mysql" is supported)
$debug boolean echo each statement as it's executed

Definition at line 42 of file SQLParser.inc.php.

References $dataSource, $debug, and $driver.

SQLParser.stripComments ( &$  sql  ) 

Strip SQL comments from SQL string.

Parameters:
$sql string

Definition at line 96 of file SQLParser.inc.php.

References String.regexp_replace().

Referenced by executeFile().


Member Data Documentation

SQLParser.$commentDelim

Delimiter for SQL comments used by the data source

Definition at line 32 of file SQLParser.inc.php.

SQLParser.$dataSource

The database connection object

Definition at line 24 of file SQLParser.inc.php.

Referenced by SQLParser().

SQLParser.$debug

Enable debugging (print SQL statements as they are executed)

Definition at line 27 of file SQLParser.inc.php.

Referenced by SQLParser().

SQLParser.$driver

The database driver

Definition at line 21 of file SQLParser.inc.php.

Referenced by SQLParser().

SQLParser.$statementDelim

Delimiter for SQL statements used by the data source

Definition at line 35 of file SQLParser.inc.php.


The documentation for this class was generated from the following file:

Generated on Mon Jul 14 10:55:47 2008 for Open Journal Systems by  doxygen 1.5.6