Get table columns.

@param string $tableName

@return array
321022
public function getColumns($tableName)
    {
        $sql = sprintf('SELECT * FROM information_schema.columns
                    WHERE table_schema=database()
                    AND table_name = %s', $this->quote($tableName));
        $rows = $this->pdo->query($sql)->fetchAll();

        $result = [];
        foreach ($rows as $row) {
            $name = $row['COLUMN_NAME'];
            $result[$name] = $row;
        }

        return $result;
    }
76494
public function listTableColumns(string $tableName) : array
    {
        $tableName = $this->tableMaybeInvalid($tableName);
        return $this
            ->getSchemaManager()
            ->listTableColumns($tableName);
    }
1122223
public function column($colName = 'ID')
    {
        $result = [];

        foreach ($this->items as $item) {
            $result[] = $this->extractValue($item, $colName);
        }

        return $result;
    }
288862
protected function getTableIndexes($tableName = null, $connectionName = null)
    {
        $tableName = $this->validateTableName($tableName);

        return $this->getSchema($connectionName)->listTableIndexes($tableName);
    }
609834
public function getColumns($table)
    {
        $table = str_replace("`", "", $table);

        $columns = Db::fetchAll("SHOW COLUMNS FROM `" . $table . "`");

        $columnNames = array();
        foreach ($columns as $column) {
            $columnNames[] = $column['Field'];
        }

        return $columnNames;
    }
1024049
public function getMetaColumns($tableName){
        $stmt = $this->query(self::META_COLUMNS_SQL, array($tableName));
        if ($stmt === false){
            return array();
        }

        $rows = array();
        foreach ($stmt as $row){
            switch($row[1]){
            case 'float8':
            case 'numeric':
                $type = PDO::PARAM_STR; // Not exists PARAM_FLOAT by current version.
                break;

            case 'int4':
            case 'int8':
                $type = PDO::PARAM_INT;
                break;

            case 'bool':
                $type = PDO::PARAM_BOOL;
                break;

            default:
                $type = PDO::PARAM_STR;
                break;
            }

            $rows[$row[0]] = $type;
        }

        return $rows;
    }
1251925
public function columns($table)
	{
		$columns = array();
		$sth = $this->queryColumnInfo($table);

		while (($row = $sth->fetch())) {
			$c = $this->createColumn($row);
			$columns[$c->name] = $c;
		}
		return $columns;
	}
500351
protected function describeTable(string $tableName): array
    {
        if (isset($this->_tableDescription[$tableName])) {
            return $this->_tableDescription[$tableName];
        }

        $result = array();
        $statement = 'DESCRIBE ' . $this->getDb()->quoteIdentifier($tableName);
        $cols = $this->fetchAll($statement);

        foreach ($cols as $col) {
            $result[$col['Field']] = $col['Type'];
        }

        $this->_tableDescription[$tableName] = $result;

        return $result;
    }
427123
public function getTableIndexes($tableName): array
    {
        $schema  = $this->getSchema();
        $indexes = $schema->listTableIndexes($tableName);

        return $indexes;
    }
364589
public function getIndexes($tableName)
    {
        $sql = sprintf('SHOW INDEX FROM %s', $this->ident($tableName));
        $rows = $this->pdo->query($sql)->fetchAll();
        $result = [];
        foreach ($rows as $row) {
            if (isset($row['Cardinality'])) {
                unset($row['Cardinality']);
            }
            $name = $row['Key_name'];
            $seq = $row['Seq_in_index'];
            $result[$name][$seq] = $row;
        }

        return $result;
    }
973299
public function getTableColumns($tableName)
    {
        $db = $this->getDb();

        $allColumns = $db->fetchAll("SHOW COLUMNS FROM " . $tableName);

        $fields = array();
        foreach ($allColumns as $column) {
            $fields[trim($column['Field'])] = $column;
        }

        return $fields;
    }
1328696
final public function &getColumnsMetadata($tableName)
    {
        if ( ! isset(self::$columns[$tableName])) {
            /* @noinspection PhpUnhandledExceptionInspection */
            self::$columns[$tableName] = (static::$useCacheForMetadata
                ? $this->retrieveColumnsCachedMetadata($tableName)
                : $this->retrieveColumnsMetadata($tableName)
            );
        }

        return self::$columns[$tableName];
    }
645807
public function getFields($tableName) {
        $this->initConnect(true);
        list($tableName) = explode(' ', $tableName);
        if(strpos($tableName,'.')){
        	list($dbName,$tableName) = explode('.',$tableName);
			$sql   = 'SHOW COLUMNS FROM `'.$dbName.'`.`'.$tableName.'`';
        }else{
        	$sql   = 'SHOW COLUMNS FROM `'.$tableName.'`';
        }
        
        $result = $this->query($sql);
        $info   =   array();
        if($result) {
            foreach ($result as $key => $val) {
				if(\PDO::CASE_LOWER != $this->_linkID->getAttribute(\PDO::ATTR_CASE)){
					$val = array_change_key_case ( $val ,  CASE_LOWER );
				}
                $info[$val['field']] = array(
                    'name'    => $val['field'],
                    'type'    => $val['type'],
                    'notnull' => (bool) ($val['null'] === ''), // not null is empty, null is yes
                    'default' => $val['default'],
                    'primary' => (strtolower($val['key']) == 'pri'),
                    'autoinc' => (strtolower($val['extra']) == 'auto_increment'),
                );
            }
        }
        return $info;
    }
618677
public static function getModelTable($tableName) {
        $mt = DATA . 'mapper' . DIRECTORY_SEPARATOR . '__modelTables.php';
        if (!is_readable($mt))
            return array();

        $modelTables = include $mt;
        if (isset($modelTables[$tableName]))
            return $modelTables[$tableName];

        return array();
    }
772348
protected function _getColumns($tableName)
    {

        $params = [
            ':schemaName' => $this->_adapter->getSchemaName(),
            ':tableName' => $tableName
        ];
        return $this->_adapter->query($this->_getColumnsSql, $params);
    }
754406
public function getFieldInformation($tableName, $fieldName)
    {
        $columns = $this->database->metaColumns($tableName);

        foreach($columns as $column) {
            if ($column->name === $fieldName) {

                return $column;
            }
        }

        return null;
    }
1144360
public function getForeignKeysReferencingTable($tableName)
    {
        $matches = [];
        foreach ($this->foreignKeys as $fk) {
            if ($fk->getForeignTableName() === $tableName) {
                $matches[] = $fk;
            }
        }

        return $matches;
    }