protected override void LoadStoredProcedures(Database schema, DbLinq.Schema.SchemaName schemaName, IDbConnection conn, DbLinq.Schema.NameFormat nameFormat) { var foriegnKeys = GetSchema("Procedures"); if (foriegnKeys == null) { return; } // throw new NotImplementedException(); }
protected override void LoadConstraints(Database schema, DbLinq.Schema.SchemaName schemaName, IDbConnection conn, DbLinq.Schema.NameFormat nameFormat, Names names) { DbConnection c = (DbConnection)conn; var foreignKeys = GetForeignKeys(c); int iConstName = foreignKeys.Columns.IndexOf("CONSTRAINT_NAME"); int iConstType = foreignKeys.Columns.IndexOf("CONSTRAINT_TYPE"); int iFromColumn = foreignKeys.Columns.IndexOf("FKEY_FROM_COLUMN"); int iFromSchema = foreignKeys.Columns.IndexOf("TABLE_SCHEMA"); int iFromTable = foreignKeys.Columns.IndexOf("TABLE_NAME"); int iToColumn = foreignKeys.Columns.IndexOf("FKEY_TO_COLUMN"); int iToSchema = foreignKeys.Columns.IndexOf("FKEY_TO_SCHEMA"); int iToTable = foreignKeys.Columns.IndexOf("FKEY_TO_TABLE"); if (iConstName < 0 || iConstType < 0 || iFromColumn < 0 || iFromSchema < 0 || iFromTable < 0 || iToColumn < 0 || iToSchema < 0 || iToTable < 0) { WriteErrorLine("Database connection '{0}' doesn't support querying foreign key information.", c.GetType().Name); return; } foreach (DataRow r in foreignKeys.Rows) { var fromTable = UnquoteSqlName(GetValue <string>(r, iFromTable, null)); var fromSchema = UnquoteSqlName(GetValue <string>(r, iFromSchema, null)); var fromColumn = UnquoteSqlName(GetValue <string>(r, iFromColumn, null)); string fullFromTable = GetFullDbName(fromTable, fromSchema); DbLinq.Schema.Dbml.Table table = schema.Tables.FirstOrDefault(t => fullFromTable == t.Name); if (table == null) { WriteErrorLine("ERROR L46: Table '" + fromTable + "' not found for column " + fromColumn); continue; } var constraintType = GetValue <string>(r, iConstType, null); var toTable = UnquoteSqlName(GetValue <string>(r, iToTable, null)); if (constraintType == "FOREIGN KEY" && toTable != null) { var constraintName = GetValue(r, iConstName, (string)null); var toColumn = UnquoteSqlName(GetValue <string>(r, iToColumn, null)); var toSchema = UnquoteSqlName(GetValue <string>(r, iToSchema, null)); LoadForeignKey(schema, table, fromColumn, fromTable, fromSchema, toColumn, toTable, toSchema, constraintName, nameFormat, names); } } }
protected override void LoadForeignKey(Database schema, Table table, string columnName, string tableName, string tableSchema, string referencedColumnName, string referencedTableName, string referencedTableSchema, string constraintName, DbLinq.Schema.NameFormat nameFormat, SchemaLoader.Names names) { var foriegnKeys = GetSchema("ForeignKeys"); if (foriegnKeys == null) { return; } // throw new NotImplementedException(); }