Skip to content

Parameters used in LIMIT and OFFSET in MySQL get quoted and quoted wrong #6778

@sma27

Description

@sma27

Bug Report

Q A
Version 4.2.2

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions