@@ -221,15 +221,13 @@ function walk($tokens, $sql, $source_map){
221221 );
222222 }
223223
224- private function generateTableKey (array $ table )
225- {
226- if (!is_null ($ table ['database ' ])) {
227- return $ table ['database ' ] . '. ' . $ table ['name ' ];
228- } else {
229- return $ table ['name ' ];
230- }
231- }
232-
224+ private function generateTableKey (array $ table ){
225+ if (!is_null ($ table ['database ' ])){
226+ return $ table ['database ' ] . '. ' . $ table ['name ' ];
227+ }else {
228+ return $ table ['name ' ];
229+ }
230+ }
233231
234232 function parse_create_table ($ tokens , $ i , $ num ){
235233
@@ -241,14 +239,15 @@ function parse_create_table($tokens, $i, $num){
241239 #
242240 # name
243241 #
244- $ database = null ;
242+
243+ $ database = null ;
245244 $ name = $ this ->decode_identifier ($ tokens [$ i ++]);
246245
247- if (isset ($ tokens [$ i ]) && $ tokens [$ i ] === '. ' ) {
248- $ i ++;
249- $ database = $ name ;
250- $ name = $ this ->decode_identifier ($ tokens [$ i ++]);
251- }
246+ if (isset ($ tokens [$ i ]) && $ tokens [$ i ] === '. ' ){
247+ $ i ++;
248+ $ database = $ name ;
249+ $ name = $ this ->decode_identifier ($ tokens [$ i ++]);
250+ }
252251
253252
254253 #
@@ -259,18 +258,18 @@ function parse_create_table($tokens, $i, $num){
259258 $ i ++;
260259 $ old_name = $ this ->decode_identifier ($ tokens [$ i ++]);
261260
262- $ like_database = null ;
263- if (isset ($ tokens [$ i ]) && $ tokens [$ i ] === '. ' ) {
264- $ i ++;
265- $ like_database = $ old_name ;
266- $ old_name = $ this ->decode_identifier ($ tokens [$ i ++]);
267- }
261+ $ like_database = null ;
262+ if (isset ($ tokens [$ i ]) && $ tokens [$ i ] === '. ' ){
263+ $ i ++;
264+ $ like_database = $ old_name ;
265+ $ old_name = $ this ->decode_identifier ($ tokens [$ i ++]);
266+ }
268267
269268 return array (
270269 'name ' => $ name ,
271270 'database ' => $ database ,
272271 'like ' => $ old_name ,
273- 'like_database ' => $ like_database ,
272+ 'like_database ' => $ like_database ,
274273 );
275274 }
276275
@@ -293,7 +292,7 @@ function parse_create_table($tokens, $i, $num){
293292
294293 $ table = array (
295294 'name ' => $ name ,
296- 'database ' => $ database ,
295+ 'database ' => $ database ,
297296 'fields ' => $ fields ,
298297 'indexes ' => $ indexes ,
299298 'props ' => $ props ,
@@ -583,6 +582,17 @@ function parse_field($tokens){
583582 case 'BLOB ' :
584583 case 'MEDIUMBLOB ' :
585584 case 'LONGBLOB ' :
585+ case 'JSON ' :
586+ case 'GEOMETRY ' :
587+ case 'POINT ' :
588+ case 'LINESTRING ' :
589+ case 'POLYGON ' :
590+ case 'MULTIPOINT ' :
591+ case 'MULTILINESTRING ' :
592+ case 'MULTIPOLYGON ' :
593+ case 'GEOMETRYCOLLECTION ' :
594+ case 'BOOLEAN ' :
595+ case 'BOOL ' :
586596
587597 # nothing more to read
588598 break ;
@@ -622,6 +632,7 @@ function parse_field($tokens){
622632 # REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]
623633 case 'REAL ' :
624634 case 'DOUBLE ' :
635+ case 'DOUBLE PRECISION ' :
625636 case 'FLOAT ' :
626637
627638 $ this ->parse_field_length_decimals ($ tokens , $ f );
@@ -633,6 +644,8 @@ function parse_field($tokens){
633644 # DECIMAL[(length[,decimals])] [UNSIGNED] [ZEROFILL]
634645 case 'DECIMAL ' :
635646 case 'NUMERIC ' :
647+ case 'DEC ' :
648+ case 'FIXED ' :
636649
637650 $ this ->parse_field_length_decimals ($ tokens , $ f );
638651 $ this ->parse_field_length ($ tokens , $ f );
@@ -667,6 +680,7 @@ function parse_field($tokens){
667680
668681 # VARCHAR(length) [BINARY] [CHARACTER SET charset_name] [COLLATE collation_name]
669682 case 'VARCHAR ' :
683+ case 'CHARACTER VARYING ' :
670684
671685 $ this ->parse_field_binary ($ tokens , $ f );
672686 $ this ->parse_field_length ($ tokens , $ f );
@@ -836,6 +850,8 @@ function _extract_tokens($sql, &$source_map){
836850 'SET NULL ' ,
837851 'NO ACTION ' ,
838852 'SET DEFAULT ' ,
853+ 'DOUBLE PRECISION ' ,
854+ 'CHARACTER VARYING ' ,
839855 );
840856
841857 $ singles = array (
0 commit comments