/** * Generate the SQL statement for this query. * * @param array $parameters Out variable for parameters required for this query * @return string The completed SQL query */ public function sql(&$parameters = array()) { // Build each component as needed $sql = DB::build_sql($this, $parameters); if (empty($sql)) { return null; } if ($this->replacementsOld) { $sql = str_replace($this->replacementsOld, $this->replacementsNew, $sql); } return $sql; }