Get all the column names in a table

@return array
775210
protected function getTableFields()
    {   
        $connection = Connection::connect();

        $driver = getenv('P_DRIVER');

        if ($driver == 'pgsql') {
            $describe = '\d ';
        }
        $describe = 'describe ';
        
        $q = $connection->prepare($describe.$this->getTableName($this->className));
        $q->execute();
        
        return $q->fetchAll(PDO::FETCH_COLUMN);        
    }
168390
public function columns(): array
    {
        $columns = $this->columns ?: [];

        if ( ! count($columns)) {
            $columns = $this->getGroupContentColumns();
        }

        // If columns are set, fill them out if they don't fit the grid
        if ($remainder = $this->getRemainderForColumns($columns)) {
            $columns[ count($columns) - 1 ] += $remainder;
        }

        return $columns;
    }
390800
protected function getColumns()
    {
        if (array_key_exists('columns', $this->searchable)) {
            $driver = $this->getDatabaseDriver();
            $prefix = Config::get("database.connections.$driver.prefix");
            $columns = [];
            foreach($this->searchable['columns'] as $column => $priority){
                $columns[$prefix . $column] = $priority;
            }
            return $columns;
        } else {
            return DB::connection()->getSchemaBuilder()->getColumnListing($this->table);
        }
    }
408722
public function getTableColumns(): array
    {
        $columns = [
            'id' => $this->headerImage(trans('HCResource::resource.preview'), 100, 100, true),
            'uploaded_by' => $this->headerText(trans('HCResource::resource.uploaded_by')),
            'path' => $this->headerText(trans('HCResource::resource.path')),
            'original_name' => $this->headerText(trans('HCResource::resource.original_name')),
            'size' => $this->headerText(trans('HCResource::resource.size')),
            'full_path' => $this->headerCopy(trans('HCResource::resource.full_path'), 'id',
                route('resource.get', '') . '/'),
        ];

        return $columns;
    }
888922
protected function getColumns() {
        if ($this->has('columns')) {
            return $this->get('columns', array());
        }
        $data = $this->get('data');
        if (empty($data)) {
            return [];
        }
        $data = (array)$data;
        $columns = array_keys(reset($data));
        $this->set('columns', $columns);
        return $columns;
    }
1248294
protected function getColumns()
    {
        $availableColumns = array_map('strtolower', $this->headers);

        if ($this->option('compact')) {
            return array_intersect($availableColumns, $this->compactColumns);
        }

        if ($columns = $this->option('columns')) {
            return array_intersect($availableColumns, $columns);
        }

        return $availableColumns;
    }
300695
public function getColumns()
    {
        if (empty($this->columns) && !empty($this->data)) {
            //parse columns from data
            $tmp = array_keys(current($this->data));
            return array_combine($tmp, $tmp);
        }

        return $this->columns;
    }
1057138
private function getColumns()
    {
        $columns = array();
        
        /**
         * Use call_user_func to make sure only public vars are returned
         */
        $vars = call_user_func('get_object_vars', $this);
        
        foreach ( $vars as $key => $value )
        {
            $columns[] = array(
                "name" => $key
            );
        }
        
        return $columns;
    }
1001113
public function getColumnNames()
    {
        $columns = array();
        foreach ($this->columns as $refColumn) {
            $columns[] = $refColumn->getColumnName();
        }

        return $columns;
    }
381777
protected function getTablesList(): array
    {
        $schemaManager = $this->conn->getSchemaManager();

        $tablesInDB = $schemaManager->listTables();
        $tables = [];
        foreach ($tablesInDB as $table) {
            if ($this->tableIgnored($table->getName())) {
                continue;
            }

            $tables[] = $this->tablesInConf[] = $table->getName();
        }

        return array_values($tables);
    }
33071
private static function getSttyColumns()
    {
        $info = static::runCommand('stty -a | grep columns');

        if ($info && preg_match('/rows.(\d+);.columns.(\d+);/i', $info, $matches)) {
            // extract [w, h] from "rows h; columns w;"
        } elseif ($info && preg_match('/;.(\d+).rows;.(\d+).columns/i', $info, $matches)) {
            // extract [w, h] from "; h rows; w columns"
        } else {
            return [];
        }

        return [(int) $matches[2], (int) $matches[1]];
    }
31535
protected function getFields()
  {
    $fields = $this->db->getTableColumns($this->tbl);
    if ( empty($fields) ){
      throw new TableException('Table columns not found');
    }
    
    return $fields;
  }
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;
    }
493434
protected function getTables(): array
    {
        $result = [];
        $sql = "SELECT *
            FROM
                information_schema.tables AS t,
                information_schema.collation_character_set_applicability AS ccsa
            WHERE
                ccsa.collation_name = t.table_collation
                AND t.table_schema=database()
                AND t.table_type = 'BASE TABLE'";

        $rows = $this->queryFetchAll($sql);

        foreach ($rows as $row) {
            $result[] = [
                'table_name' => $row['TABLE_NAME'],
                'engine' => $row['ENGINE'],
                'table_comment' => $row['TABLE_COMMENT'],
                'table_collation' => $row['TABLE_COLLATION'],
                'character_set_name' => $row['CHARACTER_SET_NAME'],
                'row_format' => $row['ROW_FORMAT'],
            ];
        }

        return $result;
    }
461802
private function getAllTableNames()
    {
        $handler = $this->databaseConnection->queryAndHandle("SHOW TABLES FROM `" . $this->databaseConnection->getDatabaseName() . "`");
        $tableNames = array();

        if ($handler->getResultSize() > 0) {
            while ($oDatabaseResultRow = $handler->fetchNextResultObject()) {
                $tablesInVariableName = "Tables_in_" . $this->databaseConnection->getDatabaseName();
                // add only tables with the current connection prefix
                if (
                    substr(
                        $oDatabaseResultRow->$tablesInVariableName,
                        0,
                        strlen($this->databaseConnection->getTablePrefix()))
                    == $this->databaseConnection->getTablePrefix()) {

                    array_push($tableNames, $oDatabaseResultRow->$tablesInVariableName);
                }

            }
        }

        return $tableNames;
    }
1328499
final public static function getColumns()
    {
        $result = [];
        foreach (static::COLUMNS as $column) {
            $result[] = trim(explode('[', $column, 2)[0]);
        }
        return $result;
    }
705514
public function getFieldsNames(): array
    {
        $fields         = static::db()->metadata()->getColumnsMetadata(static::getTableName())['fields'];
        $classVars      = array_keys(get_class_vars(get_class($this)));
        $selectedFields = array_intersect($classVars, $fields);

        return $selectedFields;
    }