/** * Compiles a SELECT query. * * @access public * @return array */ public function select() { $sql = $this->query->isDistinct() ? 'SELECT DISTINCT ' : 'SELECT '; $sql .= $this->columns($this->query->getColumns()); $sql .= ' FROM '; $sql .= $this->wrap($this->query->getTable()); $sql .= $this->joins($this->query->getJoins()); $sql .= $this->wheres($this->query->getWheres()); $sql .= $this->groupings($this->query->getGroupings()); $sql .= $this->havings($this->query->getHavings()); $sql .= $this->orderings($this->query->getOrderings()); $sql .= $this->limit($this->query->getLimit()); $sql .= $this->offset($this->query->getOffset()); return ['sql' => $sql, 'params' => $this->params]; }