Returns types of columns in given result set.
@param mysqli_result $resultset
@param string $table
@return array
177533
public function getColumnTypes($resultSet, $table){
		static $colTypes;
		if(empty($colTypes)){
			$constants = get_defined_constants(true);
			foreach($constants['mysqli'] as $type => $code){
				if(strncmp($type, 'MYSQLI_TYPE_', 12) === 0)
					$colTypes[$code] = strtolower(substr($type, 12));
			}
			$colTypes[MYSQLI_TYPE_LONG] = $colTypes[MYSQLI_TYPE_SHORT] = $colTypes[MYSQLI_TYPE_TINY] = 'int';
		}

		$cols = array();
		while($field = $resultSet->fetch_field()){
			$cols[$field->name] = $colTypes[$field->type];
		}
		return $cols;
	}
718787
static function columns($table)
    {
        $sql = "show columns from " . strtolower($table);

        $contentFile = JsonReader::read(BASE_DIR . "/phiber_config.json")->phiber->execute_querys == 1 ? true : false;
        if ($contentFile) {
            $pdo = self::getConnection()->prepare($sql);
            if ($pdo->execute()) {
                return $pdo->fetchAll(\PDO::FETCH_ASSOC);
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
1080747
private function _getColumns($table)
    {
        if (isset($this->_tables[$table])) {
            return $this->_tables[$table];
        };
        $this->_tables[$table] = false;
        if ($rows = $this->selectArray("PRAGMA table_info({$table})")) {
            $cols = array();
            foreach ($rows as $row) {
                $cols[] = $row['name'];
            };
            if (count($cols) > 0) {
                $this->_tables[$table] = $cols;
            };
        };
        return $this->_tables[$table];
    }
671193
public function getTableColumns(string $table): array {
		$query = <<<QUERY
			SELECT COLUMN_NAME
			FROM INFORMATION_SCHEMA.COLUMNS
			WHERE TABLE_SCHEMA = :database
			AND TABLE_NAME = :table
QUERY;
		
		$params = [
			"database" => $this->database,
			"table"    => $table,
		];
		
		try {
			$results = $this->getCol($query, $params);
			return is_array($results) ? $results : [];
		} catch (\PDOException $databaseException) {
			throw $this->prepareDatabaseException($databaseException, $query, $params);
		}
	}
513111
protected function normalizeResultSet(array $resultSet)
    {
        $normalized = [];

        foreach ($resultSet as $result) {
            if (($normalizedResult = $this->normalizeResult($result)) === null) {
                continue;
            }

            $normalized[$normalizedResult] = $normalizedResult;
        }

        return array_keys($normalized);
    }
823436
public static Object getValueByColumnType(final ResultSet resultSet, final int columnIndex) throws SQLException {
        ResultSetMetaData metaData = resultSet.getMetaData();
        switch (metaData.getColumnType(columnIndex)) {
            case Types.BIT:
            case Types.BOOLEAN:
                return resultSet.getBoolean(columnIndex);
            case Types.TINYINT:
                return resultSet.getByte(columnIndex);
            case Types.SMALLINT:
                return resultSet.getShort(columnIndex);
            case Types.INTEGER:
                return resultSet.getInt(columnIndex);
            case Types.BIGINT:
                return resultSet.getLong(columnIndex);
            case Types.NUMERIC:
            case Types.DECIMAL:
                return resultSet.getBigDecimal(columnIndex);
            case Types.FLOAT:
            case Types.DOUBLE:
                return resultSet.getDouble(columnIndex);
            case Types.CHAR:
            case Types.VARCHAR:
            case Types.LONGVARCHAR:
                return resultSet.getString(columnIndex);
            case Types.BINARY:
            case Types.VARBINARY:
            case Types.LONGVARBINARY:
                return resultSet.getBytes(columnIndex);
            case Types.DATE:
                return resultSet.getDate(columnIndex);
            case Types.TIME:
                return resultSet.getTime(columnIndex);
            case Types.TIMESTAMP:
                return resultSet.getTimestamp(columnIndex);
            case Types.CLOB:
                return resultSet.getClob(columnIndex);
            case Types.BLOB:
                return resultSet.getBlob(columnIndex);
            default:
                return resultSet.getObject(columnIndex);
        }
    }
869888
public function getPrimaryKey($table, $resultSet = null){
		if($resultSet instanceof PDOStatement){
			$i = 0;
			while($col = $resultSet->getColumnMeta($i++)){
				if(in_array('primary_key', $col['flags']))
					$primaryKey = $col['name'];
			}
		}
		if(isset($primaryKey))
			return $primaryKey;
		throw new ImplementationException;
	}
383822
public function getColumnTypes($resultSet, $table){
		if($table === null)
			return array();
		if(isset($this->tblData[$table]))
			$sql = $this->tblData[$table];
		else
			$q = $this->runQuery("SELECT sql FROM sqlite_master WHERE tbl_name='$table'");
		$r = $this->fetch($q);
		if($r === false)
			return array();
		$this->tblData[$table] = $sql = $r['sql'];
		$sql = explode("\n", $sql);

		$cols = array();
		foreach($sql as $field){
			$field = trim($field);
			preg_match('~^"(\w+)"\s+(integer|real|numeric|text|blob).+$~i', $field, $m);
			if(isset($m[1], $m[2]))
				$cols[$m[1]] = $m[2];
		}
		return $cols;
	}
1127213
public function getTableColumns($table, $allColumns = false)
    {
        $tableColumns = Schema::getColumnListing($table);

        $tableTypeColumns = [];
        $badColumns = ['id', 'created_at', 'updated_at'];

        if ($allColumns) {
            $badColumns = [];
        }

        foreach ($tableColumns as $column) {
            if (!in_array($column, $badColumns)) {
                $type = DB::connection()->getDoctrineColumn($table, $column)->getType()->getName();
                $tableTypeColumns[$column]['type'] = $type;
            }
        }

        return $tableTypeColumns;
    }
360946
public function getColumns ($db, $table)
	{
		
		// Get columns
		
		if (!isset ($this->columns[$db][$table]))
		{
			$this->columns[$db][$table]	= $this->db->query ('SHOW COLUMNS FROM ' . $db . '.' . $table)->fetchAll (\PDO::FETCH_NUM);
		}
		
		// Return columns
		
		return $this->columns[$db][$table];
		
	}
1250983
public function getColumns( $table ) {
		$table = $this->safeTable($table);
		$columnsRaw = $this->adapter->get("DESCRIBE $table");
		foreach($columnsRaw as $r) {
			$columns[$r['Field']]=$r['Type'];
		}
		return $columns;
	}
651222
public function select(Select $select, ResultSet\ResultSetInterface $resultSet = null)
    {
        $stmt = $this->getSql()->prepareStatementForSqlObject($select);

        $resultSet = $resultSet ?: new ResultSet\ResultSet(ResultSet\ResultSet::TYPE_ARRAY);
        $resultSet->initialize($stmt->execute());

        return $resultSet;
    }
244884
public function getTableColumns(string $table): array
    {
        $schemaTable = self::SCHEMA_COLUMN;

        $where[] = "TABLE_NAME = '{$table}'";
        $where[] = "TABLE_SCHEMA = '{$this->db}'";
        $where   = !empty($where) ? ' WHERE ' . implode(' AND ', $where) : null;

        $querySql = "SELECT `COLUMN_NAME` as `name`,`DATA_TYPE` as `type`,`CHARACTER_MAXIMUM_LENGTH` as `length`,`COLUMN_DEFAULT` as `default` ,`COLUMN_KEY` as `key`,`IS_NULLABLE` as `nullable`,`COLUMN_TYPE` as `column_type`,`COLUMN_COMMENT` as `column_comment` FROM {$schemaTable} {$where}";
        $this->dbHandler->prepare($querySql);
        $this->dbHandler->execute([]);
        $columns = $this->dbHandler->fetch();

        return !empty($columns) ? $columns : [];
    }
474338
public static function getTableColumnNames(\mysqli $mysqliConn, string $tableName) : array
    {
        $sql = "SHOW COLUMNS FROM `{$tableName}`";
        $result = $mysqliConn->query($sql);
        
        $columns = array();
        
        while (($row = $result->fetch_array()) != null)
        {
            $columns[] = $row[0];
        }
        
        return $columns;
    }
341537
final public function fetchColumnDefs(string $table) {
        $tableKey = strtolower($table);

        if (!empty($this->tables[$tableKey]['columns'])) {
            $this->tables[$tableKey]['columns'];
        } elseif ($this->tableNames !== null && !isset($this->tableNames[$tableKey])) {
            return null;
        }

        $columnDefs = $this->fetchColumnDefsDb($table);
        if ($columnDefs !== null) {
            $this->tables[$tableKey]['columns'] = $columnDefs;
        }
        return $columnDefs;
    }
93948
private function mapDocuments(ResultSet $resultSet)
    {
        $mesages = [];

        foreach ($resultSet->getResults() as $result) {
            $mesages[] = $this->mapDocument($result->getSource());
        }

        return $mesages;
    }
654590
protected function _fetchTableColumns($table)
    {
        $result = array();
        $sql    = $this->quoteName($this->getTableNeedle().$table);

        if ($columns = $this->show('SHOW FULL COLUMNS FROM '.$sql, AnDatabase::FETCH_OBJECT_LIST)) {
            foreach ($columns as $column) {
                //Set the table name in the raw info (MySQL doesn't add this)
                $column->Table = $table;

                //Parse the column raw schema data
                $column = $this->_parseColumnInfo($column, $table);

                $result[$column->name] = $column;
            }
        }

        return $result;
    }