diff options
Diffstat (limited to 'OpenSim/Data/MySQL/Tests/MySQLAssetTest.cs')
-rw-r--r-- | OpenSim/Data/MySQL/Tests/MySQLAssetTest.cs | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/OpenSim/Data/MySQL/Tests/MySQLAssetTest.cs b/OpenSim/Data/MySQL/Tests/MySQLAssetTest.cs index e1d3f81..a46fdf8 100644 --- a/OpenSim/Data/MySQL/Tests/MySQLAssetTest.cs +++ b/OpenSim/Data/MySQL/Tests/MySQLAssetTest.cs | |||
@@ -31,6 +31,7 @@ using OpenSim.Data.Tests; | |||
31 | using log4net; | 31 | using log4net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using OpenSim.Tests.Common; | 33 | using OpenSim.Tests.Common; |
34 | using MySql.Data.MySqlClient; | ||
34 | 35 | ||
35 | namespace OpenSim.Data.MySQL.Tests | 36 | namespace OpenSim.Data.MySQL.Tests |
36 | { | 37 | { |
@@ -39,7 +40,7 @@ namespace OpenSim.Data.MySQL.Tests | |||
39 | { | 40 | { |
40 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | public string file; | 42 | public string file; |
42 | public MySQLManager database; | 43 | private string m_connectionString; |
43 | public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;"; | 44 | public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;"; |
44 | 45 | ||
45 | [TestFixtureSetUp] | 46 | [TestFixtureSetUp] |
@@ -52,7 +53,6 @@ namespace OpenSim.Data.MySQL.Tests | |||
52 | // tests. | 53 | // tests. |
53 | try | 54 | try |
54 | { | 55 | { |
55 | database = new MySQLManager(connect); | ||
56 | db = new MySQLAssetData(); | 56 | db = new MySQLAssetData(); |
57 | db.Initialise(connect); | 57 | db.Initialise(connect); |
58 | } | 58 | } |
@@ -70,10 +70,22 @@ namespace OpenSim.Data.MySQL.Tests | |||
70 | { | 70 | { |
71 | db.Dispose(); | 71 | db.Dispose(); |
72 | } | 72 | } |
73 | if (database != null) | 73 | ExecuteSql("drop table migrations"); |
74 | ExecuteSql("drop table assets"); | ||
75 | } | ||
76 | |||
77 | /// <summary> | ||
78 | /// Execute a MySqlCommand | ||
79 | /// </summary> | ||
80 | /// <param name="sql">sql string to execute</param> | ||
81 | private void ExecuteSql(string sql) | ||
82 | { | ||
83 | using (MySqlConnection dbcon = new MySqlConnection(connect)) | ||
74 | { | 84 | { |
75 | database.ExecuteSql("drop table migrations"); | 85 | dbcon.Open(); |
76 | database.ExecuteSql("drop table assets"); | 86 | |
87 | MySqlCommand cmd = new MySqlCommand(sql, dbcon); | ||
88 | cmd.ExecuteNonQuery(); | ||
77 | } | 89 | } |
78 | } | 90 | } |
79 | } | 91 | } |