SQl-Parser:
- added functionality for more statements - added statement "ALTER"
Dieser Commit ist enthalten in:
Ursprung
0755afb426
Commit
78323875f2
6 geänderte Dateien mit 61 neuen und 5 gelöschten Zeilen
36
library/Msd/Sql/Parser/Statement/Alter.php
Normale Datei
36
library/Msd/Sql/Parser/Statement/Alter.php
Normale Datei
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of MySQLDumper released under the GNU/GPL 2 license
|
||||||
|
* http://www.mysqldumper.net
|
||||||
|
*
|
||||||
|
* @package MySQLDumper
|
||||||
|
* @subpackage SQL-Parser
|
||||||
|
* @version SVN: $Rev$
|
||||||
|
* @author $Author$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to parse MySQL CREATE statements.
|
||||||
|
* This enables you to analyze and modify MySQL queries, which the user has entered.
|
||||||
|
*
|
||||||
|
* @package MySQLDumper
|
||||||
|
* @subpackage SQL-Parser
|
||||||
|
*/
|
||||||
|
class Msd_Sql_Parser_Statement_Alter implements Msd_Sql_Parser_Interface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Parse the statement.
|
||||||
|
*
|
||||||
|
* @param Msd_Sql_Object $statement MySQL CREATE statement.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function parse(Msd_Sql_Object $sql)
|
||||||
|
{
|
||||||
|
$sql->setState('Alter');
|
||||||
|
$endOfStatement = $sql->getPosition(';');
|
||||||
|
$statement = $sql->getData($endOfStatement);
|
||||||
|
$sql->setPointer($endOfStatement+1);
|
||||||
|
return $statement;
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,8 +25,12 @@ class Msd_Sql_Parser_Statement_Create implements Msd_Sql_Parser_Interface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function parse(Msd_Sql_Object $statement)
|
public function parse(Msd_Sql_Object $sql)
|
||||||
{
|
{
|
||||||
|
$sql->setState('Create');
|
||||||
|
$endOfStatement = $sql->getPosition(';');
|
||||||
|
$statement = $sql->getData($endOfStatement);
|
||||||
|
$sql->setPointer($endOfStatement+1);
|
||||||
return $statement;
|
return $statement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,12 @@ class Msd_Sql_Parser_Statement_Drop implements Msd_Sql_Parser_Interface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function parse(Msd_Sql_Object $statement)
|
public function parse(Msd_Sql_Object $sql)
|
||||||
{
|
{
|
||||||
|
$sql->setState('Drop');
|
||||||
|
$endOfStatement = $sql->getPosition(';');
|
||||||
|
$statement = $sql->getData($endOfStatement);
|
||||||
|
$sql->setPointer($endOfStatement+1);
|
||||||
return $statement;
|
return $statement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,12 @@ class Msd_Sql_Parser_Statement_Insert implements Msd_Sql_Parser_Interface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function parse(Msd_Sql_Object $statement)
|
public function parse(Msd_Sql_Object $sql)
|
||||||
{
|
{
|
||||||
|
$sql->setState('Insert');
|
||||||
|
$endOfStatement = $sql->getPosition(';');
|
||||||
|
$statement = $sql->getData($endOfStatement);
|
||||||
|
$sql->setPointer($endOfStatement+1);
|
||||||
return $statement;
|
return $statement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,12 @@ class Msd_Sql_Parser_Statement_Lock implements Msd_Sql_Parser_Interface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function parse(Msd_Sql_Object $statement)
|
public function parse(Msd_Sql_Object $sql)
|
||||||
{
|
{
|
||||||
|
$sql->setState('Lock');
|
||||||
|
$endOfStatement = $sql->getPosition(';');
|
||||||
|
$statement = $sql->getData($endOfStatement);
|
||||||
|
$sql->setPointer($endOfStatement+1);
|
||||||
return $statement;
|
return $statement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,12 @@ class Msd_Sql_Parser_Statement_Unlock implements Msd_Sql_Parser_Interface
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function parse(Msd_Sql_Object $statement)
|
public function parse(Msd_Sql_Object $sql)
|
||||||
{
|
{
|
||||||
|
$sql->setState('Unlock');
|
||||||
|
$endOfStatement = $sql->getPosition(';');
|
||||||
|
$statement = $sql->getData($endOfStatement);
|
||||||
|
$sql->setPointer($endOfStatement+1);
|
||||||
return $statement;
|
return $statement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Laden …
In neuem Issue referenzieren