Skip to content

Commit

Permalink
Fixed when REPLACE is used without INTO
Browse files Browse the repository at this point in the history
Before REPLACE INTO used to get parsed, but REPLACE without INTO threw
error.
  • Loading branch information
xRahul committed Oct 11, 2016
1 parent 29bdef6 commit 759dd32
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/PHPSQLParser/processors/InsertProcessor.php
Expand Up @@ -85,6 +85,7 @@ protected function processKeyword($keyword, $tokenList) {
continue;

case 'INSERT':
case 'REPLACE':
continue;

default:
Expand Down Expand Up @@ -148,8 +149,8 @@ public function process($tokenList, $token_category = 'INSERT') {
$parsed = array_merge($parsed, $key);
unset($tokenList['INTO']);

if ($table === '' && $token_category === 'INSERT') {
list($table, $cols, $key) = $this->processKeyword('INSERT', $tokenList);
if ($table === '' && in_array($token_category, array('INSERT', 'REPLACE'))) {
list($table, $cols, $key) = $this->processKeyword($token_category, $tokenList);
}

$parsed[] = array('expr_type' => ExpressionType::TABLE, 'table' => $table,
Expand Down

0 comments on commit 759dd32

Please sign in to comment.