protected function fetchColumnDefsDb(string $table) {
        $cdefs = $this->query('pragma table_info('.$this->prefixTable($table, false).')')->fetchAll(PDO::FETCH_ASSOC);
        if (empty($cdefs)) {
            return null;
        }

        $columns = [];
        $pk = [];
        foreach ($cdefs as $cdef) {
            $column = Db::typeDef($cdef['type']);
            if ($column === null) {
                throw new \Exception("Unknown type '$columnType'.", 500);
            }
            $column['allowNull'] = !filter_var($cdef['notnull'], FILTER_VALIDATE_BOOLEAN);

            if ($cdef['pk']) {
                $pk[] = $cdef['name'];
                if (strcasecmp($cdef['type'], 'integer') === 0) {
                    $column['autoIncrement'] = true;
                } else {
                    $column['primary'] = true;
                }
            }
            if ($cdef['dflt_value'] !== null) {
                $column['default'] = $this->forceType($cdef['dflt_value'], $column['type']);
            }
            $columns[$cdef['name']] = $column;
        }
//        $tdef = ['columns' => $columns];
//        if (!empty($pk)) {
//            $tdef['indexes'][Db::INDEX_PK] = [
//                'columns' => $pk,
//                'type' => Db::INDEX_PK
//            ];
//        }
//        $this->tables[$table] = $tdef;
        return $columns;
    }
protected function fetchColumnDefsDb(string $table) {
        $cdefs = $this->query('pragma table_info('.$this->prefixTable($table, false).')')->fetchAll(PDO::FETCH_ASSOC);
        if (empty($cdefs)) {
            return null;
        }

        $columns = [];
        $pk = [];
        foreach ($cdefs as $cdef) {
            $column = Db::typeDef($cdef['type']);
            if ($column === null) {
                throw new \Exception("Unknown type '$columnType'.", 500);
            }
            $column['allowNull'] = !filter_var($cdef['notnull'], FILTER_VALIDATE_BOOLEAN);

            if ($cdef['pk']) {
                $pk[] = $cdef['name'];
                if (strcasecmp($cdef['type'], 'integer') === 0) {
                    $column['autoIncrement'] = true;
                } else {
                    $column['primary'] = true;
                }
            }
            if ($cdef['dflt_value'] !== null) {
                $column['default'] = $this->forceType($cdef['dflt_value'], $column['type']);
            }
            $columns[$cdef['name']] = $column;
        }
//        $tdef = ['columns' => $columns];
//        if (!empty($pk)) {
//            $tdef['indexes'][Db::INDEX_PK] = [
//                'columns' => $pk,
//                'type' => Db::INDEX_PK
//            ];
//        }
//        $this->tables[$table] = $tdef;
        return $columns;
    }
protected function fetchColumnDefsDb ( string $ table ) { $ cdefs = $ this -> query ( 'pragma table_info(' . $ this -> prefixTable ( $ table , false ) . ')' ) -> fetchAll ( PDO :: FETCH_ASSOC ) ; if ( empty ( $ cdefs ) ) { return null ; } $ columns = [ ] ; $ pk = [ ] ; foreach ( $ cdefs as $ cdef ) { $ column = Db :: typeDef ( $ cdef [ 'type' ] ) ; if ( $ column === null ) { throw new \ Exception ( "Unknown type '$columnType'." , 500 ) ; } $ column [ 'allowNull' ] = ! filter_var ( $ cdef [ 'notnull' ] , FILTER_VALIDATE_BOOLEAN ) ; if ( $ cdef [ 'pk' ] ) { $ pk [ ] = $ cdef [ 'name' ] ; if ( strcasecmp ( $ cdef [ 'type' ] , 'integer' ) === 0 ) { $ column [ 'autoIncrement' ] = true ; } else { $ column [ 'primary' ] = true ; } } if ( $ cdef [ 'dflt_value' ] !== null ) { $ column [ 'default' ] = $ this -> forceType ( $ cdef [ 'dflt_value' ] , $ column [ 'type' ] ) ; } $ columns [ $ cdef [ 'name' ] ] = $ column ; } //        $tdef = ['columns' => $columns]; //        if (!empty($pk)) { //            $tdef['indexes'][Db::INDEX_PK] = [ //                'columns' => $pk, //                'type' => Db::INDEX_PK //            ]; //        } //        $this->tables[$table] = $tdef; return $ columns ; }
Get the columns for a table..

@param string $table The table to get the columns for.
@return array|null Returns an array of columns.
Get the columns for a table ..