public PDAField(DataRows row) { Name = row.FieldByName("COLUMN_NAME"); Nullable = row.FieldByName("IS_NULLABLE").ToUpper() == "YES"; DataType = row.FieldByName("DATA_TYPE"); SLen = row.FieldByNameDef("CHARACTER_MAXIMUM_LENGTH", ""); PLen = row.FieldByNameDef("NUMERIC_PRECISION", ""); DLen = row.FieldByNameDef("NUMERIC_SCALE", ""); if (SLen != "") FullDataType = DataType + "(" + SLen + ")"; else { if (PLen != "") { if (DLen != "") FullDataType = DataType + "(" + PLen + ", " + DLen + ")"; else FullDataType = DataType + "(" + PLen + ")"; } else FullDataType = DataType; } if (DataType.ToLower() == "datetime") FullDataType = DataType; List<DataRows> lst; q.Select( "SELECT a.Column_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE a, INFORMATION_SCHEMA.TABLE_CONSTRAINTS b WHERE (a.CONSTRAINT_NAME = b.CONSTRAINT_NAME) AND (a.TABLE_NAME = '"+ row.FieldByName("TABLE_NAME")+"') AND COLUMN_NAME='"+Name+"' ORDER BY a.TABLE_NAME"); lst = q.GetRows(); if(lst.Count>0) { IsPK = true; } }
public static void Add(DataRows row) { foreach (PDATable table in tables) { if(table.Name == row.FieldByName("TABLE_NAME")) { table.AddField(row); return; } } PDATable newtable = new PDATable(); newtable.Name = row.FieldByName("TABLE_NAME"); tables.Add(newtable); newtable.AddField(row); }
public static void Add(DataRows row) { foreach (PDATable table in tables) { if (table.Name == row.FieldByName("TABLE_NAME")) { table.AddField(row); return; } } PDATable newtable = new PDATable(); newtable.Name = row.FieldByName("TABLE_NAME"); tables.Add(newtable); newtable.AddField(row); }
public PDAField(DataRows row) { Name = row.FieldByName("COLUMN_NAME"); Nullable = row.FieldByName("IS_NULLABLE").ToUpper() == "YES"; DataType = row.FieldByName("DATA_TYPE"); SLen = row.FieldByNameDef("CHARACTER_MAXIMUM_LENGTH", ""); PLen = row.FieldByNameDef("NUMERIC_PRECISION", ""); DLen = row.FieldByNameDef("NUMERIC_SCALE", ""); if (SLen != "") { FullDataType = DataType + "(" + SLen + ")"; } else { if (PLen != "") { if (DLen != "") { FullDataType = DataType + "(" + PLen + ", " + DLen + ")"; } else { FullDataType = DataType + "(" + PLen + ")"; } } else { FullDataType = DataType; } } if (DataType.ToLower() == "datetime") { FullDataType = DataType; } List <DataRows> lst; q.Select( "SELECT a.Column_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE a, INFORMATION_SCHEMA.TABLE_CONSTRAINTS b WHERE (a.CONSTRAINT_NAME = b.CONSTRAINT_NAME) AND (a.TABLE_NAME = '" + row.FieldByName("TABLE_NAME") + "') AND COLUMN_NAME='" + Name + "' ORDER BY a.TABLE_NAME"); lst = q.GetRows(); if (lst.Count > 0) { IsPK = true; } }
private void AddField(DataRows row) { foreach (PDAField field in fields) { if (field.Name == row.FieldByName("COLUMN_NAME")) { throw new Exception("Двойное поле"); } } PDAField newfield = new PDAField(row); fields.Add(newfield); }
private void AddField(DataRows row) { foreach (PDAField field in fields) { if(field.Name == row.FieldByName("COLUMN_NAME")) throw new Exception("Двойное поле"); } PDAField newfield = new PDAField(row); fields.Add(newfield); }