コード例 #1
0
 /**
  * Get table columns.
  *
  * @param string $table Table name.
  *
  * @return  array Table columns with type.
  */
 public function getColumns($table)
 {
     if (empty(self::$columnCache[$table])) {
         self::$columnCache[$table] = $this->db->getTableColumns($table);
     }
     return self::$columnCache[$table];
 }
コード例 #2
0
ファイル: AbstractTable.php プロジェクト: houzhenggang/cobalt
 /**
  * Get the columns from database table.
  *
  * @return mixed An array of the field names, or false if an error occurs.
  *
  * @since   1.0
  * @throws \UnexpectedValueException
  */
 public function getFields()
 {
     static $cache = null;
     if ($cache === null) {
         // Lookup the fields for this table only once.
         $fields = $this->db->getTableColumns($this->tableName, false);
         if (empty($fields)) {
             throw new \UnexpectedValueException(sprintf('No columns found for %s table', $this->tableName));
         }
         $cache = $fields;
     }
     return $cache;
 }