foreach ($this->QBSelect
as $key =>
$val) { $noEscape =
$this->QBNoEscape
[$key] ?? null;
$this->QBSelect
[$key] =
$this->db->
protectIdentifiers($val, false,
$noEscape);
} $sql .=
implode(', ',
$this->QBSelect
);
} } // Write the "FROM" portion of the query
if (!
empty($this->QBFrom
)) { $sql .= "\nFROM " .
$this->
_fromTables();
} // Write the "JOIN" portion of the query
if (!
empty($this->QBJoin
)) { $sql .= "\n" .
implode("\n",
$this->QBJoin
);
} $sql .=
$this->
compileWhereHaving('QBWhere'
) .
$this->
compileGroupBy() .
$this->
compileWhereHaving('QBHaving'
) .
$this->
compileOrderBy(); // ORDER BY