diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Statement.php | 15 | ||||
-rw-r--r-- | src/Statements/SetStatement.php | 22 |
2 files changed, 33 insertions, 4 deletions
diff --git a/src/Statement.php b/src/Statement.php index 4186275..ec715c2 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -354,12 +354,23 @@ abstract class Statement $parsedOptions = true; } } elseif ($class === null) { - // Handle special end options in Select statement - // See Statements\SelectStatement::$END_OPTIONS if ($this instanceof Statements\SelectStatement && ($token->value === 'FOR UPDATE' || $token->value === 'LOCK IN SHARE MODE') ) { + // Handle special end options in Select statement + // See Statements\SelectStatement::$END_OPTIONS + $this->end_options = OptionsArray::parse( + $parser, + $list, + static::$END_OPTIONS + ); + } elseif ($this instanceof Statements\SetStatement + && ($token->value === 'COLLATE' + || $token->value === 'DEFAULT') + ) { + // Handle special end options in SET statement + // See Statements\SetStatement::$END_OPTIONS $this->end_options = OptionsArray::parse( $parser, $list, diff --git a/src/Statements/SetStatement.php b/src/Statements/SetStatement.php index 007134f..ef3a0c1 100644 --- a/src/Statements/SetStatement.php +++ b/src/Statements/SetStatement.php @@ -28,6 +28,7 @@ class SetStatement extends Statement */ public static $CLAUSES = array( 'SET' => array('SET', 3), + '_END_OPTIONS' => array('_END_OPTIONS', 1), ); /** @@ -42,6 +43,11 @@ class SetStatement extends Statement 'PASSWORD' => array(3, 'expr'), ); + public static $END_OPTIONS = array( + 'COLLATE' => array(1, 'var'), + 'DEFAULT' => 1 + ); + /** * Options used in current statement. * @@ -50,6 +56,15 @@ class SetStatement extends Statement public $options; /** + * The end options of this query. + * + * @var OptionsArray + * + * @see static::$END_OPTIONS + */ + public $end_options; + + /** * The updated values. * * @var SetOperation[] @@ -61,7 +76,10 @@ class SetStatement extends Statement */ public function build() { - return 'SET ' . OptionsArray::build($this->options) - . ' ' . SetOperation::build($this->set); + $ret = 'SET ' . OptionsArray::build($this->options) + . ' ' . SetOperation::build($this->set) + . ' ' . OptionsArray::build($this->end_options); + + return trim($ret); } } |