Open Journal Systems  2.4.4
 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)
 

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 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
$sqlstring
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
$driverstring the database driver (currently only "mysql" is supported)
$debugboolean echo each statement as it's executed

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

SQLParser::stripComments ( $sql)

Strip SQL comments from SQL string.

Parameters
$sqlstring

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

References String\regexp_replace().

Referenced by executeFile().


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