Skip to content

Commit 2b5fe95

Browse files
authored
Merge pull request #2302 from pjsde/fix_fromTables
Fix MySql _fromTables()
2 parents 2192c0e + 51b685e commit 2b5fe95

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

system/Database/MySQLi/Builder.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,24 @@ class Builder extends BaseBuilder
5353
*/
5454
protected $escapeChar = '`';
5555

56+
/**
57+
* FROM tables
58+
*
59+
* Groups tables in FROM clauses if needed, so there is no confusion
60+
* about operator precedence.
61+
*
62+
* Note: This is only used (and overridden) by MySQL.
63+
*
64+
* @return string
65+
*/
66+
protected function _fromTables(): string
67+
{
68+
if ( ! empty($this->QBJoin) && count($this->QBFrom) > 1)
69+
{
70+
return '('.implode(', ', $this->QBFrom).')';
71+
}
72+
73+
return implode(', ', $this->QBFrom);
74+
}
75+
5676
}

0 commit comments

Comments
 (0)