summaryrefslogtreecommitdiffstats
path: root/src/Components/OptionsArray.php
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2016-09-13 10:32:25 +0200
committerGitHub <noreply@github.com>2016-09-13 10:32:25 +0200
commit30606001ca8a017be9c0837334a8c9ef52af340e (patch)
tree426acab29d4747cecac5bcea57723de510a2fba8 /src/Components/OptionsArray.php
parent496d47d54d26c12ef2832448ed7bf039f561ee3c (diff)
parente42ef817340ba146d5dd4e07f712aeb54f3c0ef6 (diff)
downloadsql-parser-30606001ca8a017be9c0837334a8c9ef52af340e.zip
sql-parser-30606001ca8a017be9c0837334a8c9ef52af340e.tar.gz
sql-parser-30606001ca8a017be9c0837334a8c9ef52af340e.tar.bz2
Merge pull request #75 from devenbansod/fix_51_74
Add correct parsing of SET CHARACTER SET, CHARSET , NAMES statements
Diffstat (limited to 'src/Components/OptionsArray.php')
-rw-r--r--src/Components/OptionsArray.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Components/OptionsArray.php b/src/Components/OptionsArray.php
index 3d2fded..c048e19 100644
--- a/src/Components/OptionsArray.php
+++ b/src/Components/OptionsArray.php
@@ -242,6 +242,25 @@ class OptionsArray extends Component
}
}
+ /*
+ * We reached the end of statement without getting a value
+ * for an option for which a value was required
+ */
+ if ($state === 1
+ && $lastOption
+ && ($lastOption[1] == 'expr'
+ || $lastOption[1] == 'var'
+ || $lastOption[1] == 'var=')
+ ) {
+ $parser->error(
+ sprintf(
+ __('Value/Expression for the option %1$s was expected'),
+ $ret->options[$lastOptionId]['name']
+ ),
+ $list->tokens[$list->idx - 1]
+ );
+ }
+
if (empty($options['_UNSORTED'])) {
ksort($ret->options);
}