protected function processColumn($tableInfo, $col)
{
$columnId = $col['Field'];
$info['ColumnName'] = "`{$columnId}`";
//quote the column names!
$info['ColumnId'] = $columnId;
$info['ColumnIndex'] = $col['index'];
if ($col['Null'] === 'YES') {
$info['AllowNull'] = true;
}
if (is_int(strpos(strtolower($col['Extra']), 'auto_increment'))) {
$info['AutoIncrement'] = true;
}
if ($col['Default'] !== "") {
$info['DefaultValue'] = $col['Default'];
}
if ($col['Key'] === 'PRI' || in_array($columnId, $tableInfo->getPrimaryKeys())) {
$info['IsPrimaryKey'] = true;
}
if ($this->isForeignKeyColumn($columnId, $tableInfo)) {
$info['IsForeignKey'] = true;
}
$info['DbType'] = $col['Type'];
$match = array();
//find SET/ENUM values, column size, precision, and scale
if (preg_match('/\\((.*)\\)/', $col['Type'], $match)) {
$info['DbType'] = preg_replace('/\\(.*\\)/', '', $col['Type']);
//find SET/ENUM values
if ($this->isEnumSetType($info['DbType'])) {
$info['DbTypeValues'] = preg_split("/[',]/S", $match[1], -1, PREG_SPLIT_NO_EMPTY);
}
//find column size, precision and scale
$pscale = array();
if (preg_match('/(\\d+)(?:,(\\d+))?+/', $match[1], $pscale)) {
if ($this->isPrecisionType($info['DbType'])) {
$info['NumericPrecision'] = intval($pscale[1]);
if (count($pscale) > 2) {
$info['NumericScale'] = intval($pscale[2]);
}
} else {
$info['ColumnSize'] = intval($pscale[1]);
}
}
}
$tableInfo->Columns[$columnId] = new TMysqlTableColumn($info);
}