internal void DisableRelationships(Connection conn) { List<string> queries = new List<string>(); string query; Dictionary<PrimaryKey, List<ForeignKey>> pks; Dictionary<ForeignKey, PrimaryKey> fks; GetPkFksCollection(conn, out pks, out fks); foreach (PrimaryKey pk in pks.Keys) { if (pks[pk].Count == 0) { query = conn.queryBuilder.DropPrimaryKey(pk); if (query.Contains("\n")) queries.AddRange(query.Split('\n')); else queries.Add(query); } } foreach (PrimaryKey pk in pks.Keys) { if (pks[pk].Count > 0) { RecurDropPK(pk, pks, fks, ref queries, conn); } } Utility.RemoveEmptyStrings(ref queries); Utility.RemoveDuplicateStrings(ref queries, null); foreach (string str in queries) { conn.ExecuteNonQuery(str); System.Threading.Thread.Sleep(50); conn.Commit(); } }
internal void EmptyAllTables(Connection conn) { List<string> tables = new List<string>(); conn.ExecuteQuery(conn.queryBuilder.SelectTableNames()); while (conn.Read()) tables.Add(conn[0].ToString()); conn.Close(); foreach (string str in tables){ conn.ExecuteNonQuery(conn.queryBuilder.DeleteAll(str)); conn.Commit(); } }