Skip to content

Commit

Permalink
Adding guard checks before checking keyword
Browse files Browse the repository at this point in the history
Signed-off-by: Fawzi Abdulfattah <[email protected]>
  • Loading branch information
iifawzi committed Jan 19, 2023
1 parent e6320e9 commit 80b39d9
Show file tree
Hide file tree
Showing 5 changed files with 827 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public function parse()
// 2 - Explain statement, in case of MariaDB https://mariadb.com/kb/en/explain-analyze/
// We need to point case 2 to use the EXPLAIN Parser.
$statementName = 'EXPLAIN';
if ($first->keyword === 'TABLE' || $second->keyword === 'TABLE') {
if (($first && $first->keyword === 'TABLE') || ($second && $second->keyword === 'TABLE')) {
$statementName = 'ANALYZE';
}

Expand Down
1 change: 1 addition & 0 deletions tests/data/parser/parseAnalyzeError1.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ANALYZE NO_WRITE_TO_BINLOG
Loading

0 comments on commit 80b39d9

Please sign in to comment.