summaryrefslogtreecommitdiffstats
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/Utils/QueryTest.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/Utils/QueryTest.php b/tests/Utils/QueryTest.php
index 124b161..c835549 100644
--- a/tests/Utils/QueryTest.php
+++ b/tests/Utils/QueryTest.php
@@ -360,6 +360,23 @@ class QueryTest extends TestCase
),
Query::getAll($query)
);
+
+ $query = 'SELECT CASE WHEN 2 IS NULL THEN "this is true" ELSE "this is false" END';
+ $parser = new Parser($query);
+ $this->assertEquals(
+ array_merge(
+ Query::getFlags($parser->statements[0], true),
+ array(
+ 'parser' => $parser,
+ 'statement' => $parser->statements[0],
+ 'select_expr' => array(
+ 'CASE WHEN 2 IS NULL THEN "this is true" ELSE "this is false" END'
+ ),
+ 'select_tables' => array(),
+ )
+ ),
+ Query::getAll($query)
+ );
}
/**