Skip to content

Commit

Permalink
Ref #168 - Add more test cases for alter table CHARACTER SET operations
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <[email protected]>
  • Loading branch information
williamdes committed Aug 15, 2021
1 parent cdb74aa commit 09fefbf
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/Parser/AlterStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ public function alterProvider()
array('parser/parseAlterErr2'),
array('parser/parseAlterErr3'),
array('parser/parseAlterErr4'),
array('parser/parseAlterWithInvisible')
array('parser/parseAlterWithInvisible'),
array('parser/parseAlterTableCharacterSet1'),
array('parser/parseAlterTableCharacterSet2'),
array('parser/parseAlterTableCharacterSet3'),
array('parser/parseAlterTableCharacterSet4'),
array('parser/parseAlterTableCharacterSet5'),
array('parser/parseAlterTableCharacterSet6'),
array('parser/parseAlterTableCharacterSet7'),
);
}
}
1 change: 1 addition & 0 deletions tests/data/parser/parseAlterTableCharacterSet1.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `d` DEFAULT CHARSET=hp8 COLLATE hp8_english_ci;
4 changes: 4 additions & 0 deletions tests/data/parser/parseAlterTableCharacterSet1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a:4:{s:5:"query";s:60:"ALTER TABLE `d` DEFAULT CHARSET=hp8 COLLATE hp8_english_ci;
";s:5:"lexer";O:26:"PhpMyAdmin\SqlParser\Lexer":8:{s:3:"str";s:60:"ALTER TABLE `d` DEFAULT CHARSET=hp8 COLLATE hp8_english_ci;
";s:3:"len";i:60;s:4:"last";i:60;s:4:"list";O:31:"PhpMyAdmin\SqlParser\TokensList":3:{s:6:"tokens";a:16:{i:0;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:5:"ALTER";s:5:"value";s:5:"ALTER";s:7:"keyword";s:5:"ALTER";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:0;}i:1;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:5;}i:2;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:5:"TABLE";s:5:"value";s:5:"TABLE";s:7:"keyword";s:5:"TABLE";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:6;}i:3;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:11;}i:4;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:3:"`d`";s:5:"value";s:1:"d";s:7:"keyword";N;s:4:"type";i:8;s:5:"flags";i:2;s:8:"position";i:12;}i:5;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:15;}i:6;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:15:"DEFAULT CHARSET";s:5:"value";s:15:"DEFAULT CHARSET";s:7:"keyword";s:15:"DEFAULT CHARSET";s:4:"type";i:1;s:5:"flags";i:7;s:8:"position";i:16;}i:7;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:"=";s:5:"value";s:1:"=";s:7:"keyword";N;s:4:"type";i:2;s:5:"flags";i:2;s:8:"position";i:31;}i:8;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:3:"hp8";s:5:"value";s:3:"hp8";s:7:"keyword";N;s:4:"type";i:0;s:5:"flags";i:0;s:8:"position";i:32;}i:9;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:35;}i:10;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:7:"COLLATE";s:5:"value";s:7:"COLLATE";s:7:"keyword";s:7:"COLLATE";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:36;}i:11;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:43;}i:12;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:14:"hp8_english_ci";s:5:"value";s:14:"hp8_english_ci";s:7:"keyword";N;s:4:"type";i:0;s:5:"flags";i:0;s:8:"position";i:44;}i:13;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:";";s:5:"value";s:1:";";s:7:"keyword";N;s:4:"type";i:9;s:5:"flags";i:0;s:8:"position";i:58;}i:14;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:"
";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:59;}i:15;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";N;s:5:"value";N;s:7:"keyword";N;s:4:"type";i:9;s:5:"flags";i:0;s:8:"position";N;}}s:5:"count";i:16;s:3:"idx";i:16;}s:9:"delimiter";s:1:";";s:12:"delimiterLen";i:1;s:6:"strict";b:0;s:6:"errors";a:0:{}}s:6:"parser";O:27:"PhpMyAdmin\SqlParser\Parser":5:{s:4:"list";r:7;s:10:"statements";a:1:{i:0;O:46:"PhpMyAdmin\SqlParser\Statements\AlterStatement":5:{s:5:"table";O:42:"PhpMyAdmin\SqlParser\Components\Expression":7:{s:8:"database";N;s:5:"table";s:1:"d";s:6:"column";N;s:4:"expr";s:3:"`d`";s:5:"alias";N;s:8:"function";N;s:8:"subquery";N;}s:7:"altered";a:1:{i:0;O:46:"PhpMyAdmin\SqlParser\Components\AlterOperation":3:{s:7:"options";O:44:"PhpMyAdmin\SqlParser\Components\OptionsArray":1:{s:7:"options";a:0:{}}s:5:"field";N;s:7:"unknown";a:0:{}}}s:7:"options";O:44:"PhpMyAdmin\SqlParser\Components\OptionsArray":1:{s:7:"options";a:1:{i:3;s:5:"TABLE";}}s:5:"first";i:0;s:4:"last";i:13;}}s:8:"brackets";i:0;s:6:"strict";b:0;s:6:"errors";a:0:{}}s:6:"errors";a:2:{s:5:"lexer";a:0:{}s:6:"parser";a:2:{i:0;a:3:{i:0;s:52:"Missing comma before start of a new alter operation.";i:1;r:51;i:2;i:0;}i:1;a:3:{i:0;s:29:"Unrecognized alter operation.";i:1;r:51;i:2;i:0;}}}}
2 changes: 2 additions & 0 deletions tests/data/parser/parseAlterTableCharacterSet2.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `d` CHARSET=hp8

7 changes: 7 additions & 0 deletions tests/data/parser/parseAlterTableCharacterSet2.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a:4:{s:5:"query";s:29:"ALTER TABLE `d` CHARSET=hp8

";s:5:"lexer";O:26:"PhpMyAdmin\SqlParser\Lexer":8:{s:3:"str";s:29:"ALTER TABLE `d` CHARSET=hp8

";s:3:"len";i:29;s:4:"last";i:29;s:4:"list";O:31:"PhpMyAdmin\SqlParser\TokensList":3:{s:6:"tokens";a:11:{i:0;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:5:"ALTER";s:5:"value";s:5:"ALTER";s:7:"keyword";s:5:"ALTER";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:0;}i:1;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:5;}i:2;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:5:"TABLE";s:5:"value";s:5:"TABLE";s:7:"keyword";s:5:"TABLE";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:6;}i:3;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:11;}i:4;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:3:"`d`";s:5:"value";s:1:"d";s:7:"keyword";N;s:4:"type";i:8;s:5:"flags";i:2;s:8:"position";i:12;}i:5;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:15;}i:6;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:7:"CHARSET";s:5:"value";s:7:"CHARSET";s:7:"keyword";s:7:"CHARSET";s:4:"type";i:1;s:5:"flags";i:33;s:8:"position";i:16;}i:7;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:"=";s:5:"value";s:1:"=";s:7:"keyword";N;s:4:"type";i:2;s:5:"flags";i:2;s:8:"position";i:23;}i:8;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:3:"hp8";s:5:"value";s:3:"hp8";s:7:"keyword";N;s:4:"type";i:0;s:5:"flags";i:0;s:8:"position";i:24;}i:9;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:2:"

";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:27;}i:10;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";N;s:5:"value";N;s:7:"keyword";N;s:4:"type";i:9;s:5:"flags";i:0;s:8:"position";N;}}s:5:"count";i:11;s:3:"idx";i:11;}s:9:"delimiter";s:1:";";s:12:"delimiterLen";i:1;s:6:"strict";b:0;s:6:"errors";a:0:{}}s:6:"parser";O:27:"PhpMyAdmin\SqlParser\Parser":5:{s:4:"list";r:7;s:10:"statements";a:1:{i:0;O:46:"PhpMyAdmin\SqlParser\Statements\AlterStatement":5:{s:5:"table";O:42:"PhpMyAdmin\SqlParser\Components\Expression":7:{s:8:"database";N;s:5:"table";s:1:"d";s:6:"column";N;s:4:"expr";s:3:"`d`";s:5:"alias";N;s:8:"function";N;s:8:"subquery";N;}s:7:"altered";a:1:{i:0;O:46:"PhpMyAdmin\SqlParser\Components\AlterOperation":3:{s:7:"options";O:44:"PhpMyAdmin\SqlParser\Components\OptionsArray":1:{s:7:"options";a:0:{}}s:5:"field";O:42:"PhpMyAdmin\SqlParser\Components\Expression":7:{s:8:"database";N;s:5:"table";N;s:6:"column";s:7:"CHARSET";s:4:"expr";s:7:"CHARSET";s:5:"alias";N;s:8:"function";N;s:8:"subquery";N;}s:7:"unknown";a:3:{i:0;r:58;i:1;r:65;i:2;r:72;}}}s:7:"options";O:44:"PhpMyAdmin\SqlParser\Components\OptionsArray":1:{s:7:"options";a:1:{i:3;s:5:"TABLE";}}s:5:"first";i:0;s:4:"last";i:10;}}s:8:"brackets";i:0;s:6:"strict";b:0;s:6:"errors";a:0:{}}s:6:"errors";a:2:{s:5:"lexer";a:0:{}s:6:"parser";a:1:{i:0;a:3:{i:0;s:29:"Unrecognized alter operation.";i:1;r:79;i:2;i:0;}}}}
1 change: 1 addition & 0 deletions tests/data/parser/parseAlterTableCharacterSet3.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `d` CHARSET=hp8;
4 changes: 4 additions & 0 deletions tests/data/parser/parseAlterTableCharacterSet3.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
a:4:{s:5:"query";s:29:"ALTER TABLE `d` CHARSET=hp8;
";s:5:"lexer";O:26:"PhpMyAdmin\SqlParser\Lexer":8:{s:3:"str";s:29:"ALTER TABLE `d` CHARSET=hp8;
";s:3:"len";i:29;s:4:"last";i:29;s:4:"list";O:31:"PhpMyAdmin\SqlParser\TokensList":3:{s:6:"tokens";a:12:{i:0;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:5:"ALTER";s:5:"value";s:5:"ALTER";s:7:"keyword";s:5:"ALTER";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:0;}i:1;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:5;}i:2;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:5:"TABLE";s:5:"value";s:5:"TABLE";s:7:"keyword";s:5:"TABLE";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:6;}i:3;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:11;}i:4;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:3:"`d`";s:5:"value";s:1:"d";s:7:"keyword";N;s:4:"type";i:8;s:5:"flags";i:2;s:8:"position";i:12;}i:5;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:15;}i:6;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:7:"CHARSET";s:5:"value";s:7:"CHARSET";s:7:"keyword";s:7:"CHARSET";s:4:"type";i:1;s:5:"flags";i:33;s:8:"position";i:16;}i:7;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:"=";s:5:"value";s:1:"=";s:7:"keyword";N;s:4:"type";i:2;s:5:"flags";i:2;s:8:"position";i:23;}i:8;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:3:"hp8";s:5:"value";s:3:"hp8";s:7:"keyword";N;s:4:"type";i:0;s:5:"flags";i:0;s:8:"position";i:24;}i:9;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:";";s:5:"value";s:1:";";s:7:"keyword";N;s:4:"type";i:9;s:5:"flags";i:0;s:8:"position";i:27;}i:10;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:"
";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:28;}i:11;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";N;s:5:"value";N;s:7:"keyword";N;s:4:"type";i:9;s:5:"flags";i:0;s:8:"position";N;}}s:5:"count";i:12;s:3:"idx";i:12;}s:9:"delimiter";s:1:";";s:12:"delimiterLen";i:1;s:6:"strict";b:0;s:6:"errors";a:0:{}}s:6:"parser";O:27:"PhpMyAdmin\SqlParser\Parser":5:{s:4:"list";r:7;s:10:"statements";a:1:{i:0;O:46:"PhpMyAdmin\SqlParser\Statements\AlterStatement":5:{s:5:"table";O:42:"PhpMyAdmin\SqlParser\Components\Expression":7:{s:8:"database";N;s:5:"table";s:1:"d";s:6:"column";N;s:4:"expr";s:3:"`d`";s:5:"alias";N;s:8:"function";N;s:8:"subquery";N;}s:7:"altered";a:1:{i:0;O:46:"PhpMyAdmin\SqlParser\Components\AlterOperation":3:{s:7:"options";O:44:"PhpMyAdmin\SqlParser\Components\OptionsArray":1:{s:7:"options";a:0:{}}s:5:"field";O:42:"PhpMyAdmin\SqlParser\Components\Expression":7:{s:8:"database";N;s:5:"table";N;s:6:"column";s:7:"CHARSET";s:4:"expr";s:7:"CHARSET";s:5:"alias";N;s:8:"function";N;s:8:"subquery";N;}s:7:"unknown";a:2:{i:0;r:58;i:1;r:65;}}}s:7:"options";O:44:"PhpMyAdmin\SqlParser\Components\OptionsArray":1:{s:7:"options";a:1:{i:3;s:5:"TABLE";}}s:5:"first";i:0;s:4:"last";i:9;}}s:8:"brackets";i:0;s:6:"strict";b:0;s:6:"errors";a:0:{}}s:6:"errors";a:2:{s:5:"lexer";a:0:{}s:6:"parser";a:1:{i:0;a:3:{i:0;s:29:"Unrecognized alter operation.";i:1;r:72;i:2;i:0;}}}}
2 changes: 2 additions & 0 deletions tests/data/parser/parseAlterTableCharacterSet4.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;

7 changes: 7 additions & 0 deletions tests/data/parser/parseAlterTableCharacterSet4.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a:4:{s:5:"query";s:61:"ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;

";s:5:"lexer";O:26:"PhpMyAdmin\SqlParser\Lexer":8:{s:3:"str";s:61:"ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;

";s:3:"len";i:61;s:4:"last";i:61;s:4:"list";O:31:"PhpMyAdmin\SqlParser\TokensList":3:{s:6:"tokens";a:16:{i:0;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:5:"ALTER";s:5:"value";s:5:"ALTER";s:7:"keyword";s:5:"ALTER";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:0;}i:1;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:5;}i:2;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:5:"TABLE";s:5:"value";s:5:"TABLE";s:7:"keyword";s:5:"TABLE";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:6;}i:3;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:11;}i:4;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:8:"tbl_name";s:5:"value";s:8:"tbl_name";s:7:"keyword";N;s:4:"type";i:0;s:5:"flags";i:0;s:8:"position";i:12;}i:5;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:20;}i:6;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:7:"CONVERT";s:5:"value";s:7:"CONVERT";s:7:"keyword";s:7:"CONVERT";s:4:"type";i:1;s:5:"flags";i:35;s:8:"position";i:21;}i:7;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:28;}i:8;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:2:"TO";s:5:"value";s:2:"TO";s:7:"keyword";s:2:"TO";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:29;}i:9;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:31;}i:10;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:13:"CHARACTER SET";s:5:"value";s:13:"CHARACTER SET";s:7:"keyword";s:13:"CHARACTER SET";s:4:"type";i:1;s:5:"flags";i:7;s:8:"position";i:32;}i:11;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:45;}i:12;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:12:"charset_name";s:5:"value";s:12:"charset_name";s:7:"keyword";N;s:4:"type";i:0;s:5:"flags";i:0;s:8:"position";i:46;}i:13;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:";";s:5:"value";s:1:";";s:7:"keyword";N;s:4:"type";i:9;s:5:"flags";i:0;s:8:"position";i:58;}i:14;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:2:"

";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:59;}i:15;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";N;s:5:"value";N;s:7:"keyword";N;s:4:"type";i:9;s:5:"flags";i:0;s:8:"position";N;}}s:5:"count";i:16;s:3:"idx";i:16;}s:9:"delimiter";s:1:";";s:12:"delimiterLen";i:1;s:6:"strict";b:0;s:6:"errors";a:0:{}}s:6:"parser";O:27:"PhpMyAdmin\SqlParser\Parser":5:{s:4:"list";r:7;s:10:"statements";a:1:{i:0;O:46:"PhpMyAdmin\SqlParser\Statements\AlterStatement":5:{s:5:"table";O:42:"PhpMyAdmin\SqlParser\Components\Expression":7:{s:8:"database";N;s:5:"table";s:8:"tbl_name";s:6:"column";N;s:4:"expr";s:8:"tbl_name";s:5:"alias";N;s:8:"function";N;s:8:"subquery";N;}s:7:"altered";a:1:{i:0;O:46:"PhpMyAdmin\SqlParser\Components\AlterOperation":3:{s:7:"options";O:44:"PhpMyAdmin\SqlParser\Components\OptionsArray":1:{s:7:"options";a:2:{i:1;s:7:"CONVERT";i:2;s:2:"TO";}}s:5:"field";N;s:7:"unknown";a:3:{i:0;r:79;i:1;r:86;i:2;r:93;}}}s:7:"options";O:44:"PhpMyAdmin\SqlParser\Components\OptionsArray":1:{s:7:"options";a:1:{i:3;s:5:"TABLE";}}s:5:"first";i:0;s:4:"last";i:13;}}s:8:"brackets";i:0;s:6:"strict";b:0;s:6:"errors";a:0:{}}s:6:"errors";a:2:{s:5:"lexer";a:0:{}s:6:"parser";a:0:{}}}
2 changes: 2 additions & 0 deletions tests/data/parser/parseAlterTableCharacterSet5.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `d` CHARACTER SET utf8;

7 changes: 7 additions & 0 deletions tests/data/parser/parseAlterTableCharacterSet5.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a:4:{s:5:"query";s:37:"ALTER TABLE `d` CHARACTER SET utf8;

";s:5:"lexer";O:26:"PhpMyAdmin\SqlParser\Lexer":8:{s:3:"str";s:37:"ALTER TABLE `d` CHARACTER SET utf8;

";s:3:"len";i:37;s:4:"last";i:37;s:4:"list";O:31:"PhpMyAdmin\SqlParser\TokensList":3:{s:6:"tokens";a:12:{i:0;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:5:"ALTER";s:5:"value";s:5:"ALTER";s:7:"keyword";s:5:"ALTER";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:0;}i:1;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:5;}i:2;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:5:"TABLE";s:5:"value";s:5:"TABLE";s:7:"keyword";s:5:"TABLE";s:4:"type";i:1;s:5:"flags";i:3;s:8:"position";i:6;}i:3;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:11;}i:4;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:3:"`d`";s:5:"value";s:1:"d";s:7:"keyword";N;s:4:"type";i:8;s:5:"flags";i:2;s:8:"position";i:12;}i:5;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:15;}i:6;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:13:"CHARACTER SET";s:5:"value";s:13:"CHARACTER SET";s:7:"keyword";s:13:"CHARACTER SET";s:4:"type";i:1;s:5:"flags";i:7;s:8:"position";i:16;}i:7;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:" ";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:29;}i:8;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:4:"utf8";s:5:"value";s:4:"utf8";s:7:"keyword";N;s:4:"type";i:0;s:5:"flags";i:0;s:8:"position";i:30;}i:9;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:1:";";s:5:"value";s:1:";";s:7:"keyword";N;s:4:"type";i:9;s:5:"flags";i:0;s:8:"position";i:34;}i:10;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";s:2:"

";s:5:"value";s:1:" ";s:7:"keyword";N;s:4:"type";i:3;s:5:"flags";i:0;s:8:"position";i:35;}i:11;O:26:"PhpMyAdmin\SqlParser\Token":6:{s:5:"token";N;s:5:"value";N;s:7:"keyword";N;s:4:"type";i:9;s:5:"flags";i:0;s:8:"position";N;}}s:5:"count";i:12;s:3:"idx";i:12;}s:9:"delimiter";s:1:";";s:12:"delimiterLen";i:1;s:6:"strict";b:0;s:6:"errors";a:0:{}}s:6:"parser";O:27:"PhpMyAdmin\SqlParser\Parser":5:{s:4:"list";r:7;s:10:"statements";a:1:{i:0;O:46:"PhpMyAdmin\SqlParser\Statements\AlterStatement":5:{s:5:"table";O:42:"PhpMyAdmin\SqlParser\Components\Expression":7:{s:8:"database";N;s:5:"table";s:1:"d";s:6:"column";N;s:4:"expr";s:3:"`d`";s:5:"alias";N;s:8:"function";N;s:8:"subquery";N;}s:7:"altered";a:1:{i:0;O:46:"PhpMyAdmin\SqlParser\Components\AlterOperation":3:{s:7:"options";O:44:"PhpMyAdmin\SqlParser\Components\OptionsArray":1:{s:7:"options";a:0:{}}s:5:"field";N;s:7:"unknown";a:3:{i:0;r:51;i:1;r:58;i:2;r:65;}}}s:7:"options";O:44:"PhpMyAdmin\SqlParser\Components\OptionsArray":1:{s:7:"options";a:1:{i:3;s:5:"TABLE";}}s:5:"first";i:0;s:4:"last";i:9;}}s:8:"brackets";i:0;s:6:"strict";b:0;s:6:"errors";a:0:{}}s:6:"errors";a:2:{s:5:"lexer";a:0:{}s:6:"parser";a:1:{i:0;a:3:{i:0;s:29:"Unrecognized alter operation.";i:1;r:72;i:2;i:0;}}}}
2 changes: 2 additions & 0 deletions tests/data/parser/parseAlterTableCharacterSet6.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `d` CHARACTER SET utf8 COLLATE utf8_general_ci;

Loading

0 comments on commit 09fefbf

Please sign in to comment.