Ejemplo n.º 1
0
        public SqlLiteFunctionTests()
        {
            dstore = SqlLiteDataConnection.GetDataStore(Path.GetTempFileName());
            InitHelper.AttachEvents(dstore);

            List<DBObject> data = dstore.SchemaValidator.ViewValidator.GetObjects().Where(R => R.Name != "sqlite_sequence").ToList();
            while (data.Count != 0)
            {
                foreach (DBObject t in data)
                {
                    if (t.Name.Equals("sqlite_sequence")) continue;
                    SQLiteCommand cmd = new SQLiteCommand();
                    cmd.CommandText = string.Format("DROP VIEW {0}", t.Name);
                    try { dstore.ExecuteCommand(cmd); }
                    catch { }
                }
                data = dstore.SchemaValidator.ViewValidator.GetObjects(true).Where(R => R.Name != "sqlite_sequence").ToList();
            }

            data = dstore.SchemaValidator.TableValidator.GetObjects().Where(R => R.Name != "sqlite_sequence").ToList();
            while (data.Count != 0)
            {
                foreach (DBObject t in data)
                {
                    if (t.Name.Equals("sqlite_sequence")) continue;
                    SQLiteCommand cmd = new SQLiteCommand();
                    cmd.CommandText = string.Format("DROP TABLE {0}", t.Name);
                    try { dstore.ExecuteCommand(cmd); }
                    catch { }
                }
                data = dstore.SchemaValidator.TableValidator.GetObjects(true).Where(R => R.Name != "sqlite_sequence").ToList();
            }
        }