src/PDO/SchemaPDOSqlite.php
/**
     * Loads the column information into a {@see ColumnSchema} object.
     *
     * @param array $info column information.
     *
     * @return ColumnSchema the column schema object.
     *
     * @psalm-param array{cid:string, name:string, type:string, notnull:string, dflt_value:string|null, pk:string} $info
     */
Loads the column information into a  ColumnSchema object.
@param array $info column information.

@return ColumnSchema the column schema object.


Loads the column information into a ColumnSchema object . @param array $info column information . @return ColumnSchema the column schema object .
protected function loadColumnSchema(array $info): ColumnSchema
    {
        $column = $this->createColumnSchema();
        $column->name($info['name']);
        $column->allowNull(!$info['notnull']);
        $column->primaryKey($info['pk'] !== '0');
        $column->dbType(strtolower($info['type']));
        $column->unsigned(str_contains($column->getDbType(), 'unsigned'));
        $column->type(self::TYPE_STRING);
        if (preg_match('/^(\w+)(?:\(([^)]+)\))?/', $column->getDbType(), $matches)) {
            $type = strtolower($matches[1]);
            if (isset($this->typeMap[$type])) {
                $column->type($this->typeMap[$type]);
            }
            if (!empty($matches[2])) {
                $values = explode(',', $matches[2]);
                $column->precision((int) $values[0]);
                $column->size((int) $values[0]);
                if (isset($values[1])) {
                    $column->scale((int) $values[1]);
                }
                if ($column->getSize() === 1 && ($type === 'tinyint' || $type === 'bit')) {
                    $column->type('boolean');
                } elseif ($type === 'bit') {
                    if ($column->getSize() > 32) {
                        $column->type('bigint');
                    } elseif ($column->getSize() === 32) {
                        $column->type('integer');
                    }
                }
            }
        }
        $column->phpType($this->getColumnPhpType($column));
        if (!$column->isPrimaryKey()) {
            if ($info['dflt_value'] === 'null' || $info['dflt_value'] === '' || $info['dflt_value'] === null) {
                $column->defaultValue(null);
            } elseif ($column->getType() === 'timestamp' && $info['dflt_value'] === 'CURRENT_TIMESTAMP') {
                $column->defaultValue(new Expression('CURRENT_TIMESTAMP'));
            } else {
                $value = trim($info['dflt_value'], "'\"");
                $column->defaultValue($column->phpTypecast($value));
            }
        }
        return $column;
    }
protected function loadColumnSchema ( array $ info ) : ColumnSchema { $ column = $ this -> createColumnSchema ( ) ; $ column -> name ( $ info [ 'name' ] ) ; $ column -> allowNull ( ! $ info [ 'notnull' ] ) ; $ column -> primaryKey ( $ info [ 'pk' ] !== '0' ) ; $ column -> dbType ( strtolower ( $ info [ 'type' ] ) ) ; $ column -> unsigned ( str_contains ( $ column -> getDbType ( ) , 'unsigned' ) ) ; $ column -> type ( self :: TYPE_STRING ) ; if ( preg_match ( '/^(\w+)(?:\(([^)]+)\))?/' , $ column -> getDbType ( ) , $ matches ) ) { $ type = strtolower ( $ matches [ 1 ] ) ; if ( isset ( $ this -> typeMap [ $ type ] ) ) { $ column -> type ( $ this -> typeMap [ $ type ] ) ; } if ( ! empty ( $ matches [ 2 ] ) ) { $ values = explode ( ',' , $ matches [ 2 ] ) ; $ column -> precision ( ( int ) $ values [ 0 ] ) ; $ column -> size ( ( int ) $ values [ 0 ] ) ; if ( isset ( $ values [ 1 ] ) ) { $ column -> scale ( ( int ) $ values [ 1 ] ) ; } if ( $ column -> getSize ( ) === 1 && ( $ type === 'tinyint' || $ type === 'bit' ) ) { $ column -> type ( 'boolean' ) ; } elseif ( $ type === 'bit' ) { if ( $ column -> getSize ( ) > 32 ) { $ column -> type ( 'bigint' ) ; } elseif ( $ column -> getSize ( ) === 32 ) { $ column -> type ( 'integer' ) ; } } } } $ column -> phpType ( $ this -> getColumnPhpType ( $ column ) ) ; if ( ! $ column -> isPrimaryKey ( ) ) { if ( $ info [ 'dflt_value' ] === 'null' || $ info [ 'dflt_value' ] === '' || $ info [ 'dflt_value' ] === null ) { $ column -> defaultValue ( null ) ; } elseif ( $ column -> getType ( ) === 'timestamp' && $ info [ 'dflt_value' ] === 'CURRENT_TIMESTAMP' ) { $ column -> defaultValue ( new Expression ( 'CURRENT_TIMESTAMP' ) ) ; } else { $ value = trim ( $ info [ 'dflt_value' ] , " ' \" " ) ; $ column -> defaultValue ( $ column -> phpTypecast ( $ value ) ) ; } } return $ column ; }
Loads the column information into a {@see ColumnSchema} object.
Loads the column information into a { @see ColumnSchema } object .