Skip to content

Commit 45227af

Browse files
authored
Merge pull request #213 from xRahul/master
Fixed when REPLACE is used without INTO
2 parents 29bdef6 + 759dd32 commit 45227af

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/PHPSQLParser/processors/InsertProcessor.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ protected function processKeyword($keyword, $tokenList) {
8585
continue;
8686

8787
case 'INSERT':
88+
case 'REPLACE':
8889
continue;
8990

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

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

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

0 commit comments

Comments
 (0)