We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pdo_mysql driver
Double quotes parameters in LIMIT and OFFSET
MySQL query like the following: $query = " SELECT * FROM my_table LIMIT :limit OFFSET :offset";
$qb->executeQuery($query, ['limit' => 10, 'offset' => 2]);
Throws an exception. It appears the SQL is being run as:
SELECT * FROM my_table LIMIT ''10'' OFFSET ''2''
My temporary fix was not to use parameters in the limit or offset, but shouldn't this be supported?
The parameters passed in to the executeQuery functions are int parameters. I wouldn't expect them to be treated as strings.
SELECT * FROM my_table LIMIT 10 OFFSET 2
This is what I'd expect the SQL to be.
The text was updated successfully, but these errors were encountered:
It works if I pass in a types array, but it should be able to detect this in my opinion.
$qb->executeQuery($query, ['limit' => 10, 'offset' => 2], ['limit' => \Doctrine\DBAL\ParameterType::INTEGER, 'offset' => \Doctrine\DBAL\ParameterType::INTEGER]);
Sorry, something went wrong.
No branches or pull requests
Bug Report
pdo_mysql driver
Summary
Double quotes parameters in LIMIT and OFFSET
Current behavior
MySQL query like the following:
$query = "
SELECT *
FROM my_table
LIMIT :limit OFFSET :offset";
$qb->executeQuery($query, ['limit' => 10, 'offset' => 2]);
Throws an exception. It appears the SQL is being run as:
SELECT *
FROM my_table
LIMIT ''10'' OFFSET ''2''
My temporary fix was not to use parameters in the limit or offset, but shouldn't this be supported?
Expected behavior
The parameters passed in to the executeQuery functions are int parameters. I wouldn't expect them to be treated as strings.
SELECT *
FROM my_table
LIMIT 10 OFFSET 2
This is what I'd expect the SQL to be.
The text was updated successfully, but these errors were encountered: