コード例 #1
0
 /**
  * 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);
     }
 }
コード例 #2
0
ファイル: datagrid.php プロジェクト: ss23/ECommerce
 /**
  * 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);
     }
 }