protected function processColumn($tableInfo, $col)
{
$columnId = $col['attname'];
//use column name as column Id
$info['ColumnName'] = '"' . $columnId . '"';
//quote the column names!
$info['ColumnId'] = $columnId;
$info['ColumnIndex'] = $col['index'];
if (!$col['attnotnull']) {
$info['AllowNull'] = true;
}
if (in_array($columnId, $tableInfo->getPrimaryKeys())) {
$info['IsPrimaryKey'] = true;
}
if ($this->isForeignKeyColumn($columnId, $tableInfo)) {
$info['IsForeignKey'] = true;
}
if ($col['atttypmod'] > 0) {
$info['ColumnSize'] = $col['atttypmod'] - 4;
}
if ($col['atthasdef']) {
$info['DefaultValue'] = $col['adsrc'];
}
if ($col['attisserial'] || substr($col['adsrc'], 0, 8) === 'nextval(') {
if (($sequence = $this->getSequenceName($tableInfo, $col['adsrc'])) !== null) {
$info['SequenceName'] = $sequence;
unset($info['DefaultValue']);
}
}
$matches = array();
if (preg_match('/\\((\\d+)(?:,(\\d+))?+\\)/', $col['type'], $matches)) {
$info['DbType'] = preg_replace('/\\(\\d+(?:,\\d+)?\\)/', '', $col['type']);
if ($this->isPrecisionType($info['DbType'])) {
$info['NumericPrecision'] = intval($matches[1]);
if (count($matches) > 2) {
$info['NumericScale'] = intval($matches[2]);
}
} else {
$info['ColumnSize'] = intval($matches[1]);
}
} else {
$info['DbType'] = $col['type'];
}
$tableInfo->Columns[$columnId] = new TPgsqlTableColumn($info);
}