aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs')
-rw-r--r--OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs16
1 files changed, 11 insertions, 5 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
index e7e158d..b39bb19 100644
--- a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
+++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
@@ -48,6 +48,7 @@ namespace OpenSim.Data.SQLite
48 protected string m_Realm; 48 protected string m_Realm;
49 protected FieldInfo m_DataField = null; 49 protected FieldInfo m_DataField = null;
50 50
51 protected static SqliteConnection m_Connection;
51 private static bool m_initialized; 52 private static bool m_initialized;
52 53
53 public SQLiteGenericTableHandler(string connectionString, 54 public SQLiteGenericTableHandler(string connectionString,
@@ -63,9 +64,14 @@ namespace OpenSim.Data.SQLite
63 if (storeName != String.Empty) 64 if (storeName != String.Empty)
64 { 65 {
65 Assembly assem = GetType().Assembly; 66 Assembly assem = GetType().Assembly;
67 SqliteConnection newConnection =
68 (SqliteConnection)((ICloneable)m_Connection).Clone();
69 newConnection.Open();
66 70
67 Migration m = new Migration(m_Connection, assem, storeName); 71 Migration m = new Migration(newConnection, assem, storeName);
68 m.Update(); 72 m.Update();
73 newConnection.Close();
74 newConnection.Dispose();
69 } 75 }
70 76
71 m_initialized = true; 77 m_initialized = true;
@@ -136,7 +142,7 @@ namespace OpenSim.Data.SQLite
136 142
137 protected T[] DoQuery(SqliteCommand cmd) 143 protected T[] DoQuery(SqliteCommand cmd)
138 { 144 {
139 IDataReader reader = ExecuteReader(cmd); 145 IDataReader reader = ExecuteReader(cmd, m_Connection);
140 if (reader == null) 146 if (reader == null)
141 return new T[0]; 147 return new T[0];
142 148
@@ -191,7 +197,7 @@ namespace OpenSim.Data.SQLite
191 result.Add(row); 197 result.Add(row);
192 } 198 }
193 199
194 CloseReaderCommand(cmd); 200 CloseCommand(cmd);
195 201
196 return result.ToArray(); 202 return result.ToArray();
197 } 203 }
@@ -240,7 +246,7 @@ namespace OpenSim.Data.SQLite
240 246
241 cmd.CommandText = query; 247 cmd.CommandText = query;
242 248
243 if (ExecuteNonQuery(cmd) > 0) 249 if (ExecuteNonQuery(cmd, m_Connection) > 0)
244 return true; 250 return true;
245 251
246 return false; 252 return false;
@@ -253,7 +259,7 @@ namespace OpenSim.Data.SQLite
253 cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field); 259 cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field);
254 cmd.Parameters.Add(new SqliteParameter(field, val)); 260 cmd.Parameters.Add(new SqliteParameter(field, val));
255 261
256 if (ExecuteNonQuery(cmd) > 0) 262 if (ExecuteNonQuery(cmd, m_Connection) > 0)
257 return true; 263 return true;
258 264
259 return false; 265 return false;