summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Components/Limit.php5
-rw-r--r--src/Statements/CreateStatement.php10
-rw-r--r--src/Statements/SetStatement.php8
3 files changed, 20 insertions, 3 deletions
diff --git a/src/Components/Limit.php b/src/Components/Limit.php
index e0c7199..16dad29 100644
--- a/src/Components/Limit.php
+++ b/src/Components/Limit.php
@@ -89,6 +89,11 @@ class Limit extends Component
continue;
}
+ // Skip if not a number
+ if (($token->type !== Token::TYPE_NUMBER)) {
+ break;
+ }
+
if ($offset) {
$ret->offset = $token->value;
$offset = false;
diff --git a/src/Statements/CreateStatement.php b/src/Statements/CreateStatement.php
index 48773bd..64ea57d 100644
--- a/src/Statements/CreateStatement.php
+++ b/src/Statements/CreateStatement.php
@@ -62,6 +62,7 @@ class CreateStatement extends Statement
'TRIGGER' => 6,
'USER' => 6,
'VIEW' => 6,
+ 'SCHEMA' => 6,
// CREATE TABLE
'IF NOT EXISTS' => 7,
@@ -378,7 +379,7 @@ class CreateStatement extends Statement
$fields = ArrayObj::build($this->fields);
}
}
- if ($this->options->has('DATABASE')) {
+ if ($this->options->has('DATABASE') || $this->options->has('SCHEMA')) {
return 'CREATE '
. OptionsArray::build($this->options) . ' '
. Expression::build($this->name) . ' '
@@ -466,12 +467,15 @@ class CreateStatement extends Statement
$this->options = OptionsArray::parse($parser, $list, static::$OPTIONS);
++$list->idx; // Skipping last option.
+ $isDatabase = $this->options->has('DATABASE') || $this->options->has('SCHEMA');
+ $fieldName = $isDatabase ? 'database' : 'table';
+
// Parsing the field name.
$this->name = Expression::parse(
$parser,
$list,
[
- 'parseField' => 'table',
+ 'parseField' => $fieldName,
'breakOnAlias' => true,
]
);
@@ -496,7 +500,7 @@ class CreateStatement extends Statement
++$nextidx;
}
- if ($this->options->has('DATABASE')) {
+ if ($isDatabase) {
$this->entityOptions = OptionsArray::parse(
$parser,
$list,
diff --git a/src/Statements/SetStatement.php b/src/Statements/SetStatement.php
index 08e986c..80a1dc7 100644
--- a/src/Statements/SetStatement.php
+++ b/src/Statements/SetStatement.php
@@ -55,6 +55,14 @@ class SetStatement extends Statement
3,
'expr',
],
+ 'SESSION' => 3,
+ 'GLOBAL' => 3,
+ 'PERSIST' => 3,
+ 'PERSIST_ONLY' => 3,
+ '@@SESSION' => 3,
+ '@@GLOBAL' => 3,
+ '@@PERSIST' => 3,
+ '@@PERSIST_ONLY' => 3,
];
public static $END_OPTIONS = [