protected function loadColumnSchema($info)
    {
        $column = $this->createColumnSchema();

        $column->name = $info['column_name'];
        $column->allowNull = $info['is_nullable'] === 'YES';
        $column->dbType = $info['data_type'];
        $column->enumValues = []; // mssql has only vague equivalents to enum
        $column->isPrimaryKey = null; // primary key will be determined in findColumns() method
        $column->autoIncrement = $info['is_identity'] == 1;
        $column->unsigned = stripos($column->dbType, 'unsigned') !== false;
        $column->comment = $info['comment'] === null ? '' : $info['comment'];

        $column->type = self::TYPE_STRING;
        if (preg_match('/^(\w+)(?:\(([^\)]+)\))?/', $column->dbType, $matches)) {
            $type = $matches[1];
            if (isset($this->typeMap[$type])) {
                $column->type = $this->typeMap[$type];
            }
            if (!empty($matches[2])) {
                $values = explode(',', $matches[2]);
                $column->size = $column->precision = (int) $values[0];
                if (isset($values[1])) {
                    $column->scale = (int) $values[1];
                }
                if ($column->size === 1 && ($type === 'tinyint' || $type === 'bit')) {
                    $column->type = 'boolean';
                } elseif ($type === 'bit') {
                    if ($column->size > 32) {
                        $column->type = 'bigint';
                    } elseif ($column->size === 32) {
                        $column->type = 'integer';
                    }
                }
            }
        }

        $column->phpType = $this->getColumnPhpType($column);

        if ($info['column_default'] === '(NULL)') {
            $info['column_default'] = null;
        }
        if (!$column->isPrimaryKey && ($column->type !== 'timestamp' || $info['column_default'] !== 'CURRENT_TIMESTAMP')) {
            $column->defaultValue = $column->phpTypecast($info['column_default']);
        }

        return $column;
    }
protected function loadColumnSchema($info)
    {
        $column = $this->createColumnSchema();

        $column->name = $info['column_name'];
        $column->allowNull = $info['is_nullable'] === 'YES';
        $column->dbType = $info['data_type'];
        $column->enumValues = []; 
        $column->isPrimaryKey = null; 
        $column->autoIncrement = $info['is_identity'] == 1;
        $column->unsigned = stripos($column->dbType, 'unsigned') !== false;
        $column->comment = $info['comment'] === null ? '' : $info['comment'];

        $column->type = self::TYPE_STRING;
        if (preg_match('/^(\w+)(?:\(([^\)]+)\))?/', $column->dbType, $matches)) {
            $type = $matches[1];
            if (isset($this->typeMap[$type])) {
                $column->type = $this->typeMap[$type];
            }
            if (!empty($matches[2])) {
                $values = explode(',', $matches[2]);
                $column->size = $column->precision = (int) $values[0];
                if (isset($values[1])) {
                    $column->scale = (int) $values[1];
                }
                if ($column->size === 1 && ($type === 'tinyint' || $type === 'bit')) {
                    $column->type = 'boolean';
                } elseif ($type === 'bit') {
                    if ($column->size > 32) {
                        $column->type = 'bigint';
                    } elseif ($column->size === 32) {
                        $column->type = 'integer';
                    }
                }
            }
        }

        $column->phpType = $this->getColumnPhpType($column);

        if ($info['column_default'] === '(NULL)') {
            $info['column_default'] = null;
        }
        if (!$column->isPrimaryKey && ($column->type !== 'timestamp' || $info['column_default'] !== 'CURRENT_TIMESTAMP')) {
            $column->defaultValue = $column->phpTypecast($info['column_default']);
        }

        return $column;
    }
protected function loadColumnSchema ( $ info ) { $ column = $ this -> createColumnSchema ( ) ; $ column -> name = $ info [ 'column_name' ] ; $ column -> allowNull = $ info [ 'is_nullable' ] === 'YES' ; $ column -> dbType = $ info [ 'data_type' ] ; $ column -> enumValues = [ ] ; // mssql has only vague equivalents to enum $ column -> isPrimaryKey = null ; // primary key will be determined in findColumns() method $ column -> autoIncrement = $ info [ 'is_identity' ] == 1 ; $ column -> unsigned = stripos ( $ column -> dbType , 'unsigned' ) !== false ; $ column -> comment = $ info [ 'comment' ] === null ? '' : $ info [ 'comment' ] ; $ column -> type = self :: TYPE_STRING ; if ( preg_match ( '/^(\w+)(?:\(([^\)]+)\))?/' , $ column -> dbType , $ matches ) ) { $ type = $ matches [ 1 ] ; if ( isset ( $ this -> typeMap [ $ type ] ) ) { $ column -> type = $ this -> typeMap [ $ type ] ; } if ( ! empty ( $ matches [ 2 ] ) ) { $ values = explode ( ',' , $ matches [ 2 ] ) ; $ column -> size = $ column -> precision = ( int ) $ values [ 0 ] ; if ( isset ( $ values [ 1 ] ) ) { $ column -> scale = ( int ) $ values [ 1 ] ; } if ( $ column -> size === 1 && ( $ type === 'tinyint' || $ type === 'bit' ) ) { $ column -> type = 'boolean' ; } elseif ( $ type === 'bit' ) { if ( $ column -> size > 32 ) { $ column -> type = 'bigint' ; } elseif ( $ column -> size === 32 ) { $ column -> type = 'integer' ; } } } } $ column -> phpType = $ this -> getColumnPhpType ( $ column ) ; if ( $ info [ 'column_default' ] === '(NULL)' ) { $ info [ 'column_default' ] = null ; } if ( ! $ column -> isPrimaryKey && ( $ column -> type !== 'timestamp' || $ info [ 'column_default' ] !== 'CURRENT_TIMESTAMP' ) ) { $ column -> defaultValue = $ column -> phpTypecast ( $ info [ 'column_default' ] ) ; } return $ column ; }
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 .