public function parseColumnType($colType)
    {
        $colInfo = array();
        $colParts = explode(" ", $colType['Type']);

        if ($fparen = strpos($colParts[0], "(")) {
            $colInfo['type'] = substr($colParts[0], 0, $fparen);
            $colInfo['length'] = str_replace(")", "", substr($colParts[0], $fparen + 1));
            $colInfo['attributes'] = isset($colParts[1]) ? $colParts[1] : null;
        } else {
            $colInfo['type'] = $colParts[0];
        }
        $colInfo['is_numeric'] = in_array($colInfo['type'], $this->mysqlTypes['numerical']);
        $colInfo['is_blob'] = in_array($colInfo['type'], $this->mysqlTypes['blob']);
        // for virtual columns that are of type 'Extra', column type
        // could by "STORED GENERATED" or "VIRTUAL GENERATED"
        // MySQL reference: https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html
        $colInfo['is_virtual'] = strpos($colType['Extra'], "VIRTUAL GENERATED") !== false || strpos($colType['Extra'], "STORED GENERATED") !== false;

        return $colInfo;
    }
public function parseColumnType($colType)
    {
        $colInfo = array();
        $colParts = explode(" ", $colType['Type']);

        if ($fparen = strpos($colParts[0], "(")) {
            $colInfo['type'] = substr($colParts[0], 0, $fparen);
            $colInfo['length'] = str_replace(")", "", substr($colParts[0], $fparen + 1));
            $colInfo['attributes'] = isset($colParts[1]) ? $colParts[1] : null;
        } else {
            $colInfo['type'] = $colParts[0];
        }
        $colInfo['is_numeric'] = in_array($colInfo['type'], $this->mysqlTypes['numerical']);
        $colInfo['is_blob'] = in_array($colInfo['type'], $this->mysqlTypes['blob']);
        // for virtual columns that are of type 'Extra', column type
        // could by "STORED GENERATED" or "VIRTUAL GENERATED"
        // MySQL reference: https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html
        $colInfo['is_virtual'] = strpos($colType['Extra'], "VIRTUAL GENERATED") !== false || strpos($colType['Extra'], "STORED GENERATED") !== false;

        return $colInfo;
    }
public function parseColumnType ( $ colType ) { $ colInfo = array ( ) ; $ colParts = explode ( " " , $ colType [ 'Type' ] ) ; if ( $ fparen = strpos ( $ colParts [ 0 ] , "(" ) ) { $ colInfo [ 'type' ] = substr ( $ colParts [ 0 ] , 0 , $ fparen ) ; $ colInfo [ 'length' ] = str_replace ( ")" , "" , substr ( $ colParts [ 0 ] , $ fparen + 1 ) ) ; $ colInfo [ 'attributes' ] = isset ( $ colParts [ 1 ] ) ? $ colParts [ 1 ] : null ; } else { $ colInfo [ 'type' ] = $ colParts [ 0 ] ; } $ colInfo [ 'is_numeric' ] = in_array ( $ colInfo [ 'type' ] , $ this -> mysqlTypes [ 'numerical' ] ) ; $ colInfo [ 'is_blob' ] = in_array ( $ colInfo [ 'type' ] , $ this -> mysqlTypes [ 'blob' ] ) ; // for virtual columns that are of type 'Extra', column type // could by "STORED GENERATED" or "VIRTUAL GENERATED" // MySQL reference: https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html $ colInfo [ 'is_virtual' ] = strpos ( $ colType [ 'Extra' ] , "VIRTUAL GENERATED" ) !== false || strpos ( $ colType [ 'Extra' ] , "STORED GENERATED" ) !== false ; return $ colInfo ; }
Decode column metadata and fill info structure.
type, is_numeric and is_blob will always be available.

@param array $colType Array returned from "SHOW COLUMNS FROM tableName"
@return array
Decode column metadata and fill info structure . type is_numeric and is_blob will always be available .