Skip to content

Bug in Query builder Join #2099

@qhung

Description

@qhung

Hello,

Currently, I am tired with JOIN and DB :: expr()
Is the code below a bug?
if ($this->_table instanceof \Database_Query_Builder_Select)
{
// Compile the subquery and add it
$sql .= ' ('.$this->_table->compile().')';
}
elseif ($this->_table instanceof \Database_Expression)
{
// Compile the expression and add its value
$sql .= ' ('.trim($this->_table->value(), ' ()').')'; <== bug
}
Why trim() with ' ()' is used?

Example, i am using in my code:
$qr->join(DB::expr(" table FORCE INDEX(PRIMARY) "), 'INNER');
Its make after of ')' is lost.

table FORCE INDEX ( PRIMARY

Thanks!

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