diff options
author | Michal Čihař <michal@cihar.com> | 2017-02-06 11:57:13 +0100 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2017-02-06 12:00:36 +0100 |
commit | 1a1168169c3d3acdf7ee3c5f1a839bcb66829297 (patch) | |
tree | 9155edf897f19bfc003991e300630f3a67f2ffd5 /src/Utils/Query.php | |
parent | 5fdfa5b0767c8b62e5dd16f1b99465c2d59c9d2f (diff) | |
download | sql-parser-1a1168169c3d3acdf7ee3c5f1a839bcb66829297.zip sql-parser-1a1168169c3d3acdf7ee3c5f1a839bcb66829297.tar.gz sql-parser-1a1168169c3d3acdf7ee3c5f1a839bcb66829297.tar.bz2 |
Use keyword attribute for comparing keyword name
We do not uppercase non reserved keywords, so this way we make the
comparison properly handle that.
Signed-off-by: Michal Čihař <michal@cihar.com>
Diffstat (limited to 'src/Utils/Query.php')
-rw-r--r-- | src/Utils/Query.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Utils/Query.php b/src/Utils/Query.php index 32bc96d..6d1aa87 100644 --- a/src/Utils/Query.php +++ b/src/Utils/Query.php @@ -553,7 +553,7 @@ class Query * * @var string */ - $clauseType = $lexer->list->getNextOfType(Token::TYPE_KEYWORD)->value; + $clauseType = $lexer->list->getNextOfType(Token::TYPE_KEYWORD)->keyword; /** * The index of this clause. @@ -605,10 +605,10 @@ class Query if ($brackets == 0) { // Checking if the section was changed. if (($token->type === Token::TYPE_KEYWORD) - && (isset($clauses[$token->value])) - && ($clauses[$token->value] >= $currIdx) + && (isset($clauses[$token->keyword])) + && ($clauses[$token->keyword] >= $currIdx) ) { - $currIdx = $clauses[$token->value]; + $currIdx = $clauses[$token->keyword]; if (($skipFirst) && ($currIdx == $clauseIdx)) { // This token is skipped (not added to the old // clause) because it will be replaced. @@ -821,11 +821,11 @@ class Query if ($brackets == 0) { if (($token->type === Token::TYPE_KEYWORD) - && (isset($clauses[$token->value])) - && ($clause === $token->value) + && (isset($clauses[$token->keyword])) + && ($clause === $token->keyword) ) { return $i; - } elseif ($token->value === 'UNION') { + } elseif ($token->keyword === 'UNION') { return -1; } } |