diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index d8967d9ce..b8b2bbafa 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -43,7 +43,9 @@ if (! defined('PMA_MINIMUM_COMMON')) { * Include data for the SQL Parser */ require_once './libraries/sqlparser.data.php'; - require_once './libraries/mysql_charsets.lib.php'; + if (!defined('TESTSUITE')) { + require_once './libraries/mysql_charsets.lib.php'; + } if (!isset($mysql_charsets)) { $mysql_charsets = array(); $mysql_charsets_count = 0; @@ -2091,8 +2093,8 @@ if (! defined('PMA_MINIMUM_COMMON')) { $docu = TRUE; break; } // end switch - // inner_sql is a span that exists for all cases - // of $cfg['SQP']['fmtType'] to make possible a replacement + // inner_sql is a span that exists for all cases + // of $cfg['SQP']['fmtType'] to make possible a replacement // for inline editing $str .= ''; $close_docu_link = false; diff --git a/test/PMA_SQL_parser_test.php b/test/PMA_SQL_parser_test.php new file mode 100644 index 000000000..3eb6849a4 --- /dev/null +++ b/test/PMA_SQL_parser_test.php @@ -0,0 +1,64 @@ +assertEquals($parsed_sql, $expected); + } + + public function testParse_1() + { + $this->assertParser('SELECT 1;', array ( + 'raw' => 'SELECT 1;', + 0 => + array ( + 'type' => 'alpha_reservedWord', + 'data' => 'SELECT', + 'pos' => 6, + 'forbidden' => true, + ), + 1 => + array ( + 'type' => 'digit_integer', + 'data' => '1', + 'pos' => 8, + ), + 2 => + array ( + 'type' => 'punct_queryend', + 'data' => ';', + 'pos' => 0, + ), + 'len' => 3, + )); + } + +} +?>