Nette\Database\Drivers\SqliteDriver::getColumns PHP Method

getColumns() public method

Returns metadata for all columns in a table.
public getColumns ( $table )
    public function getColumns($table)
    {
        $meta = $this->connection->query("\n\t\t\tSELECT sql FROM sqlite_master WHERE type = 'table' AND name = {$this->connection->quote($table)}\n\t\t\tUNION ALL\n\t\t\tSELECT sql FROM sqlite_temp_master WHERE type = 'table' AND name = {$this->connection->quote($table)}\n\t\t")->fetch();
        $columns = [];
        foreach ($this->connection->query("PRAGMA table_info({$this->delimite($table)})") as $row) {
            $column = $row['name'];
            $pattern = "/(\"{$column}\"|\\[{$column}\\]|{$column})\\s+[^,]+\\s+PRIMARY\\s+KEY\\s+AUTOINCREMENT/Ui";
            $type = explode('(', $row['type']);
            $columns[] = ['name' => $column, 'table' => $table, 'nativetype' => strtoupper($type[0]), 'size' => isset($type[1]) ? (int) $type[1] : NULL, 'unsigned' => FALSE, 'nullable' => $row['notnull'] == '0', 'default' => $row['dflt_value'], 'autoincrement' => (bool) preg_match($pattern, $meta['sql']), 'primary' => $row['pk'] > 0, 'vendor' => (array) $row];
        }
        return $columns;
    }