class SqlParser
Service class for parsing a large SQL string into an array of SQL statements
Methods
setSQL(string $sql)
Sets the inner SQL string for this object. |
||
string |
getSQL()
Gets the inner SQL string for this object. |
|
static integer |
executeString(string $input, ConnectionInterface $connection)
Execute a list of DDL statements based on a string Does not use transactions since they are not supported in DDL statements |
|
static integer |
executeFile(string $file, ConnectionInterface $connection)
Execute a list of DDL statements based on the path to the SQL file Does not use transactions since they are not supported in DDL statements |
|
static array |
parseString(string $input)
Explodes a SQL string into an array of SQL statements. |
|
static array |
parseFile(string $file)
Explodes a SQL file into an array of SQL statements. |
|
convertLineFeedsToUnixStyle() | ||
stripSQLCommentLines() | ||
array |
explodeIntoStatements()
Explodes the inner SQL string into statements based on the SQL statement delimiter (;) |
|
string |
getNextStatement()
Gets the next SQL statement in the inner SQL string, and advances the cursor to the end of this statement. |
Details
at line 35
public
setSQL(string $sql)
Sets the inner SQL string for this object.
Also resets the parsing cursor (see getNextStatement)
at line 47
public string
getSQL()
Gets the inner SQL string for this object.
at line 61
static public integer
executeString(string $input, ConnectionInterface $connection)
Execute a list of DDL statements based on a string Does not use transactions since they are not supported in DDL statements
at line 75
static public integer
executeFile(string $file, ConnectionInterface $connection)
Execute a list of DDL statements based on the path to the SQL file Does not use transactions since they are not supported in DDL statements
at line 130
static public array
parseString(string $input)
Explodes a SQL string into an array of SQL statements.
at line 159
static public array
parseFile(string $file)
Explodes a SQL file into an array of SQL statements.
at line 168
public
convertLineFeedsToUnixStyle()
at line 173
public
stripSQLCommentLines()
at line 186
public array
explodeIntoStatements()
Explodes the inner SQL string into statements based on the SQL statement delimiter (;)
at line 203
public string
getNextStatement()
Gets the next SQL statement in the inner SQL string, and advances the cursor to the end of this statement.