public function getTableFields($table, $withPrefix = false)
    {
        $fullTable = $withPrefix ? $table : $this->getTable($table);
        if (isset($this->tableFields[$fullTable])) {
            return $this->tableFields[$fullTable];
        } else {
            $fields = array();
            switch ($this->driver) {
                case 'mysql':
                    $tableInfo = $this->fetchAll("SHOW COLUMNS FROM $fullTable");
                    $fields = $this->filter($tableInfo, 'Field');
                    break;

                case 'sqlite':
                    $tableInfo = $this->fetchAll("PRAGMA table_info($fullTable)");
                    $fields = $this->filter($tableInfo, 'name');
                    break;

                case 'pgsql':
                    $tableInfo = $this->fetchAll(
                        "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS
                        WHERE table_catalog = ? AND table_name = ?
                        ORDER BY dtd_identifier ASC",
                        array($this->dbname, $fullTable)
                    );
                    $fields = $this->filter($tableInfo, 'column_name');
            }
            if (empty($fields)) {
                // For SQLite and PostgreSQL
                throw new \PDOException(sprintf('Table or view "%s" not found', $fullTable));
            }
            return $this->tableFields[$table] = $fields;
        }
    }
public function getTableFields($table, $withPrefix = false)
    {
        $fullTable = $withPrefix ? $table : $this->getTable($table);
        if (isset($this->tableFields[$fullTable])) {
            return $this->tableFields[$fullTable];
        } else {
            $fields = array();
            switch ($this->driver) {
                case 'mysql':
                    $tableInfo = $this->fetchAll("SHOW COLUMNS FROM $fullTable");
                    $fields = $this->filter($tableInfo, 'Field');
                    break;

                case 'sqlite':
                    $tableInfo = $this->fetchAll("PRAGMA table_info($fullTable)");
                    $fields = $this->filter($tableInfo, 'name');
                    break;

                case 'pgsql':
                    $tableInfo = $this->fetchAll(
                        "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS
                        WHERE table_catalog = ? AND table_name = ?
                        ORDER BY dtd_identifier ASC",
                        array($this->dbname, $fullTable)
                    );
                    $fields = $this->filter($tableInfo, 'column_name');
            }
            if (empty($fields)) {
                // For SQLite and PostgreSQL
                throw new \PDOException(sprintf('Table or view "%s" not found', $fullTable));
            }
            return $this->tableFields[$table] = $fields;
        }
    }
public function getTableFields ( $ table , $ withPrefix = false ) { $ fullTable = $ withPrefix ? $ table : $ this -> getTable ( $ table ) ; if ( isset ( $ this -> tableFields [ $ fullTable ] ) ) { return $ this -> tableFields [ $ fullTable ] ; } else { $ fields = array ( ) ; switch ( $ this -> driver ) { case 'mysql' : $ tableInfo = $ this -> fetchAll ( "SHOW COLUMNS FROM $fullTable" ) ; $ fields = $ this -> filter ( $ tableInfo , 'Field' ) ; break ; case 'sqlite' : $ tableInfo = $ this -> fetchAll ( "PRAGMA table_info($fullTable)" ) ; $ fields = $ this -> filter ( $ tableInfo , 'name' ) ; break ; case 'pgsql' : $ tableInfo = $ this -> fetchAll ( "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS
                        WHERE table_catalog = ? AND table_name = ?
                        ORDER BY dtd_identifier ASC" , array ( $ this -> dbname , $ fullTable ) ) ; $ fields = $ this -> filter ( $ tableInfo , 'column_name' ) ; } if ( empty ( $ fields ) ) { // For SQLite and PostgreSQL throw new \ PDOException ( sprintf ( 'Table or view "%s" not found' , $ fullTable ) ) ; } return $ this -> tableFields [ $ table ] = $ fields ; } }
Returns the name of fields of specified table

@param string $table
@param bool $withPrefix
@throws \PDOException
@return array
Returns the name of fields of specified table