public Table(SqlConnection conn, DataRow row, DataBase dataBase, Dictionary <string, List <int> > primaryKeys, Dictionary <string, List <int> > uniqueColumns) { FullName = DataTableTools.GetValue <string>($"{row["full_name"]}"); Name = DataTableTools.GetValue <string>(row["name"]); ID = DataTableTools.GetValue <int>(row["id"]); GetColumns(conn); Database = dataBase; if (primaryKeys.ContainsKey(FullName)) { foreach (int primaryKeyId in primaryKeys[FullName]) { Columns[primaryKeyId].IsPrimaryKey = true; } } if (uniqueColumns.ContainsKey(FullName)) { foreach (int uniqueColumnId in uniqueColumns[FullName]) { Columns[uniqueColumnId].IsUnique = true; } } }
public DataBase(SqlConnection conn, DataRow dataRow) { Name = DataTableTools.GetValue <string>(dataRow["name"]); ID = DataTableTools.GetValue <int>(dataRow["database_id"]); GetTables(conn); }
public Column(DataRow row, Table table) { ID = (int)row["COLUMN_ID"]; Name = row["COLUMN_NAME"] as string; Ordinal = (short)(int)row["ORDINAL_POSITION"]; IsNullable = ((string)row["IS_NULLABLE"]).Equals("YES"); DataType = (SqlDataType)Enum.Parse(typeof(SqlDataType), (string)row["DATA_TYPE"], true); CharacterMaxLength = DataTableTools.GetValue <int>(row["CHARACTER_MAXIMUM_LENGTH"]); Precision = DataTableTools.GetValue <byte>(row["NUMERIC_PRECISION"]); PrecisionRadix = DataTableTools.GetValue <short>(row["NUMERIC_PRECISION_RADIX"]); Scale = DataTableTools.GetValue <int>(row["NUMERIC_SCALE"]); DateTimePrecision = DataTableTools.GetValue <short>(row["DATETIME_PRECISION"]); CharacterSetCatalog = DataTableTools.GetValue <string>(row["CHARACTER_SET_CATALOG"]); CharacterSetSchema = DataTableTools.GetValue <string>(row["CHARACTER_SET_SCHEMA"]); CharacterSetName = DataTableTools.GetValue <string>(row["CHARACTER_SET_NAME"]); Table = table; }