summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2017-07-12 16:33:05 +0200
committerMichal Čihař <michal@cihar.com>2017-07-12 16:33:05 +0200
commit83bac701ade8d37314a7de98080925cfc14ffd4d (patch)
tree6f824b761ffea183a7e6bcb4617585aec2e7c4c4 /src
parentaa59439bb8e0f9980fce2c0d98706909436cfe96 (diff)
downloadsql-parser-83bac701ade8d37314a7de98080925cfc14ffd4d.zip
sql-parser-83bac701ade8d37314a7de98080925cfc14ffd4d.tar.gz
sql-parser-83bac701ade8d37314a7de98080925cfc14ffd4d.tar.bz2
Correctly handle CASE expression in SELECT statement
Fixes https://github.com/phpmyadmin/phpmyadmin/issues/13487 Signed-off-by: Michal Čihař <michal@cihar.com>
Diffstat (limited to 'src')
-rw-r--r--src/Utils/Query.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Utils/Query.php b/src/Utils/Query.php
index 0d53920..c5931c9 100644
--- a/src/Utils/Query.php
+++ b/src/Utils/Query.php
@@ -6,6 +6,7 @@
namespace PhpMyAdmin\SqlParser\Utils;
+use PhpMyAdmin\SqlParser\Components\CaseExpression;
use PhpMyAdmin\SqlParser\Components\Expression;
use PhpMyAdmin\SqlParser\Lexer;
use PhpMyAdmin\SqlParser\Parser;
@@ -442,6 +443,8 @@ class Query
if (!in_array($arr, $ret['select_tables'])) {
$ret['select_tables'][] = $arr;
}
+ } elseif ($expr instanceof CaseExpression) {
+ $ret['select_expr'][] = CaseExpression::build($expr);
} else {
$ret['select_expr'][] = $expr->expr;
}