private void ParseColumnInfo(DataRow row)
{
ColumnName = row["COLUMN_NAME"].ToString();
AllowNull = row["IS_NULLABLE"] != DBNull.Value && row["IS_NULLABLE"].ToString() == "YES";
Comment = row["COLUMN_COMMENT"].ToString();
Collation = row["COLLATION_NAME"].ToString();
CharacterSet = row["CHARACTER_SET_NAME"].ToString();
DefaultValue = row["COLUMN_DEFAULT"].ToString();
string columnType = row["COLUMN_TYPE"].ToString().ToLowerInvariant();
int index = columnType.IndexOf(' ');
if (index == -1)
index = columnType.Length;
DataType = columnType.Substring(0, index);
CleanDataType();
columnType = columnType.Substring(index);
IsUnsigned = columnType.IndexOf("unsigned") != -1;
IsZerofill = columnType.IndexOf("zerofill") != -1;
PrimaryKey = row["COLUMN_KEY"].ToString() == "PRI";
Precision = DataRowHelpers.GetValueAsInt32(row, "NUMERIC_PRECISION");
Scale = DataRowHelpers.GetValueAsInt32(row, "NUMERIC_SCALE");
string extra = row["EXTRA"].ToString().ToLowerInvariant();
if (extra != null)
AutoIncrement = extra.IndexOf("auto_increment") != -1;
}