diff options
author | Michal Čihař <michal@cihar.com> | 2017-07-12 16:33:05 +0200 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2017-07-12 16:33:05 +0200 |
commit | 83bac701ade8d37314a7de98080925cfc14ffd4d (patch) | |
tree | 6f824b761ffea183a7e6bcb4617585aec2e7c4c4 /tests | |
parent | aa59439bb8e0f9980fce2c0d98706909436cfe96 (diff) | |
download | sql-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.php | 17 |
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) + ); } /** |