public foreign_key(SQLiteConnectionStringBuilder SQLConnSetting, SQLiteDataReader rs, foreign_keys owner) { _Owner = owner; SQLConnSet.ConnectionString = SQLConnSetting.ConnectionString; AddFromRecordSet(rs); _ForeignKeyColumns = new foreign_key_columns(SQLConnSet, this); }
public foreign_key_column(SQLiteConnectionStringBuilder SQLConnSetting, int constraint_object_id, foreign_key_columns owner) { _Owner = owner; SQLConnSet.ConnectionString = SQLConnSetting.ConnectionString; using (SQLiteConnection Conn = new SQLiteConnection(SQLConnSet.ConnectionString)) { Conn.Open(); using (SQLiteCommand Com = Conn.CreateCommand()) { Com.CommandTimeout = 10; Com.CommandText = "SELECT constraint_object_id, constraint_column_id, parent_object_id, parent_column_id, referenced_object_id, referenced_column_id FROM sys.foreign_key_columns WHERE parent_object_id=" + owner.Owner.Owner.Owner.object_id + " AND constraint_object_id=" + constraint_object_id; SQLiteDataReader rs = Com.ExecuteReader(); while (rs.Read()) { AddFromRecordSet(rs); } rs.Close(); Conn.Close(); rs.Dispose(); } } }
public foreign_key(SQLiteConnectionStringBuilder SQLConnSetting, int object_id, foreign_keys owner) { _Owner = owner; SQLConnSet.ConnectionString = SQLConnSetting.ConnectionString; using (SQLiteConnection Conn = new SQLiteConnection(SQLConnSet.ConnectionString)) { Conn.Open(); using (SQLiteCommand Com = Conn.CreateCommand()) { Com.CommandTimeout = 10; Com.CommandText = "SELECT name, object_id, principal_id, schema_id, parent_object_id, type, type_desc, create_date, modify_date, is_ms_shipped, is_published, is_schema_published, referenced_object_id, key_index_id, is_disabled, is_not_for_replication, is_not_trusted, delete_referential_action, delete_referential_action_desc, update_referential_action, update_referential_action_desc, is_system_named FROM sys.foreign_keys WHERE object_id=" + object_id + " AND parent_object_id=" + owner.Owner.object_id + " ORDER BY name"; SQLiteDataReader rs = Com.ExecuteReader(); while (rs.Read()) { AddFromRecordSet(rs); } rs.Close(); Conn.Close(); rs.Dispose(); } } _ForeignKeyColumns = new foreign_key_columns(SQLConnSet, this); }