/** * Get the list of columns. * * @return array */ public function getColumns() { // has results if ($this->numResults != 0) { // build query switch ($this->db->getDriver()) { case 'mysql': $query = substr_count($this->query, 'LIMIT ') > 0 ? $this->query : $this->query . ' LIMIT 1'; break; default: throw new SpoonDataGridException('No datagrid support has been written for this database backend (' . $this->db->getDriver() . ')'); break; } // fetch record $record = $this->db->getRecord($query, $this->queryParameters); // fetch columns return array_keys($record); } }
/** * Get the list of columns. * * @return array */ public function getColumns() { // has results if ($this->numResults != 0) { // build query switch ($this->db->getDriver()) { case 'mysql': // @todo davy - this might also be LIMIT with a tab before or after instead of a space, use a decent regular expression to fix this. $query = substr_count($this->query, 'LIMIT ') > 0 ? $this->query : $this->query . ' LIMIT 1'; break; default: throw new SpoonDataGridException('No datagrid support has been written for this database backend (' . $this->db->getDriver() . ')'); break; } // fetch record $record = $this->db->getRecord($query, $this->queryParameters); // fetch columns return array_keys($record); } }