Open
Description
When building queries, the LIMIT is re-formatted. For example SELECT * FROM tbl LIMIT 1
is changed to SELECT * FROM tbl LIMIT 0, 1
. This works just fine for SELECT queries, but not for DELETE or UPDATE queries.
Example:
$query1 = "DELETE FROM a LIMIT 1";
$parser = new PhpMyAdmin\SqlParser\Parser($query1);
$statement = $parser->statements[0];
$table2 = new \PhpMyAdmin\SqlParser\Components\Expression("", "b", "", "");
$statement->from[0] = $table2;
echo $statement->build();
results in
DELETE FROM `b` LIMIT 0, 1
The changed query fails, while the original query is perfect SQL.