From 6322a085b3141bbf91ad11f86e9e8c8d5c5b3be5 Mon Sep 17 00:00:00 2001 From: AlexRa Date: Tue, 18 May 2010 14:30:17 +0300 Subject: Minor corrections in BasicDataServiceTest.cs (added more functions for cleaning up DB from the derived tests) --- OpenSim/Data/Tests/BasicDataServiceTest.cs | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs index 82f29d6..e91a45d 100644 --- a/OpenSim/Data/Tests/BasicDataServiceTest.cs +++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs @@ -167,5 +167,46 @@ namespace OpenSim.Data.Tests } } } + + /// Clear tables listed as parameters (without dropping them). + /// + /// + protected virtual void ResetMigrations(params string[] stores) + { + string lst = ""; + foreach (string store in stores) + { + string s = "'" + store + "'"; + if (lst == "") + lst = s; + else + lst += ", " + s; + } + + try + { + ExecuteSql("DELETE FROM `migrations` where name in (" + lst + ");"); + } + catch + { + } + } + + /// Clear tables listed as parameters (without dropping them). + /// + /// + protected virtual void ClearTables(params string[] tables) + { + foreach (string tbl in tables) + { + try + { + ExecuteSql("DELETE FROM " + tbl + ";"); + } + catch + { + } + } + } } } -- cgit v1.1