Skip to content

Commit

Permalink
Merge pull request #213 from xRahul/master
Browse files Browse the repository at this point in the history
Fixed when REPLACE is used without INTO
  • Loading branch information
greenlion committed Oct 12, 2016
2 parents 29bdef6 + 759dd32 commit 45227af
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 45227af

Please sign in to comment.