Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
SQLParser Class Reference

Public Member Functions

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

Public Attributes

 $commentDelim
 
 $dataSource
 
 $debug
 
 $driver
 
 $errorMsg
 
 $statementDelim
 

Detailed Description

Class for parsing and executing statements in SQL files.

Definition at line 17 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
$filestring full path to the file
$failOnErrorboolean stop execution if an error is encountered
Returns
boolean true if no errors occurred, false otherwise

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

SQLParser::getErrorMsg ( )

Return the last error message that occurred in parsing.

Returns
string

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

& SQLParser::parseStatements ( $sql)

Parse SQL content into individual SQL statements.

Parameters
$sqlstring
Returns
array

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

SQLParser::SQLParser (   $driver,
$dataSource,
  $debug = false 
)

Constructor.

Parameters
$driverstring the database driver (currently only "mysql" is supported)
$debugboolean echo each statement as it's executed

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

SQLParser::stripComments ( $sql)

Strip SQL comments from SQL string.

Parameters
$sqlstring

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

Member Data Documentation

string SQLParser::$commentDelim

Delimiter for SQL comments used by the data source

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

object SQLParser::$dataSource

The database connection object

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

boolean SQLParser::$debug

Enable debugging (print SQL statements as they are executed)

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

string SQLParser::$driver

The database driver

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

string SQLParser::$errorMsg

Error message

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

string SQLParser::$statementDelim

Delimiter for SQL statements used by the data source

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


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