Skip to content

Wrong parse query with placeholders #320

@ksandrj

Description

@ksandrj

Version: 3.2.6

Bug Description

The issue likely originated in the following commit 7972f60
SQL placeholders are being misinterpreted during query compilation, resulting in invalid syntax.

Steps To Reproduce

The following code is a simplified excerpt from a larger query, but it still demonstrates the issue

$where = [
    'sublog.id >= ?' => $oldestRowId,
] ;

$query = $this->db->query(
    'SELECT duration WHERE ?',
    $where,
);

This generates the following invalid SQL

SELECT duration 
WHERE (`sublog`.`id` >= 39 ?)

Expected Behavior

The query should compile to valid SQL like this

SELECT duration 
WHERE (`sublog`.`id` >= 39)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions