Skip to content

Commit 7797423

Browse files
committed
Fixed DELIMITER statements in BufferedQuery.
1 parent edb0f11 commit 7797423

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Utils/BufferedQuery.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ public function extract($end = false)
283283
* `strtoupper(substr($this->query, $i, 9)) === 'DELIMITER'`
284284
*
285285
* This optimization makes the code about 3 times faster.
286+
*
287+
* `DELIMITER` is not being considered a keyword. The only context
288+
* it has a special meaning is when it is the beginning of a
289+
* statement. This is the reason for the last condition.
286290
*/
287291
if (($i + 9 < $len)
288292
&& (($this->query[$i ] === 'D') || ($this->query[$i ] === 'd'))
@@ -295,6 +299,7 @@ public function extract($end = false)
295299
&& (($this->query[$i + 7] === 'E') || ($this->query[$i + 7] === 'e'))
296300
&& (($this->query[$i + 8] === 'R') || ($this->query[$i + 8] === 'r'))
297301
&& (Context::isWhitespace($this->query[$i + 9]))
302+
&& (trim($this->current) === '')
298303
) {
299304
// Saving the current index to be able to revert any parsing
300305
// done in this block.

0 commit comments

Comments
 (0)