@@ -467,21 +467,26 @@ public function parse()
467
467
}
468
468
469
469
$ lastIdx = $ list ->idx ;
470
-
471
- ++$ list ->idx ; // Skip ANALYZE
472
- $ first = $ list ->getNextOfType (Token::TYPE_KEYWORD );
473
- $ second = $ list ->getNextOfType (Token::TYPE_KEYWORD );
474
470
$ statementName = null ;
475
471
476
- // ANALYZE keyword can be an indication of two cases:
477
- // 1- ANALAYZE TABLE statements, in both mariaDB and MySQL
478
- // 2- Explain statement, in case of mariaDB https://mariadb.com/kb/en/explain-analyze/
479
- // We need to point case 2 to use the EXPLAIN Parser.
480
- if ($ token ->keyword === 'ANALYZE ' && $ first ->keyword !== 'TABLE ' && $ second ->keyword !== 'TABLE ' ) {
472
+ if ($ token ->keyword === 'ANALYZE ' ) {
473
+ ++$ list ->idx ; // Skip ANALYZE
474
+
475
+ $ first = $ list ->getNextOfType (Token::TYPE_KEYWORD );
476
+ $ second = $ list ->getNextOfType (Token::TYPE_KEYWORD );
477
+
478
+ // ANALYZE keyword can be an indication of two cases:
479
+ // 1- ANALAYZE TABLE statements, in both mariaDB and MySQL
480
+ // 2- Explain statement, in case of mariaDB https://mariadb.com/kb/en/explain-analyze/
481
+ // We need to point each case to the correct parser
482
+ if ($ first ->keyword === 'TABLE ' || $ second ->keyword === 'TABLE ' ) {
483
+ $ statementName = 'ANALYZE ' ;
484
+ } else {
485
+ $ statementName = 'EXPLAIN ' ;
486
+ }
487
+
481
488
$ list ->idx = $ lastIdx ;
482
- $ statementName = 'EXPLAIN ' ;
483
489
} else {
484
- $ list ->idx = $ lastIdx ;
485
490
// Checking if it is a known statement that can be parsed.
486
491
if (empty (static ::$ STATEMENT_PARSERS [$ token ->keyword ])) {
487
492
if (! isset (static ::$ STATEMENT_PARSERS [$ token ->keyword ])) {
0 commit comments