aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteFramework.cs36
1 files changed, 22 insertions, 14 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs
index 2a8a022..96764f3 100644
--- a/OpenSim/Data/SQLite/SQLiteFramework.cs
+++ b/OpenSim/Data/SQLite/SQLiteFramework.cs
@@ -40,12 +40,10 @@ namespace OpenSim.Data.SQLite
40 /// </summary> 40 /// </summary>
41 public class SQLiteFramework 41 public class SQLiteFramework
42 { 42 {
43 protected SqliteConnection m_Connection; 43 protected Object m_lockObject = new Object();
44 44
45 protected SQLiteFramework(string connectionString) 45 protected SQLiteFramework(string connectionString)
46 { 46 {
47 //m_Connection = new SqliteConnection(connectionString);
48 //m_Connection.Open();
49 } 47 }
50 48
51 ////////////////////////////////////////////////////////////// 49 //////////////////////////////////////////////////////////////
@@ -55,9 +53,13 @@ namespace OpenSim.Data.SQLite
55 // 53 //
56 protected int ExecuteNonQuery(SqliteCommand cmd) 54 protected int ExecuteNonQuery(SqliteCommand cmd)
57 { 55 {
58 lock (m_Connection) 56 lock (m_lockObject)
59 { 57 {
60 cmd.Connection = m_Connection; 58 SqliteConnection newConnection =
59 (SqliteConnection)((ICloneable)m_Connection).Clone();
60 newConnection.Open();
61
62 cmd.Connection = newConnection;
61 Console.WriteLine("XXX " + cmd.CommandText); 63 Console.WriteLine("XXX " + cmd.CommandText);
62 64
63 return cmd.ExecuteNonQuery(); 65 return cmd.ExecuteNonQuery();
@@ -66,20 +68,26 @@ namespace OpenSim.Data.SQLite
66 68
67 protected IDataReader ExecuteReader(SqliteCommand cmd) 69 protected IDataReader ExecuteReader(SqliteCommand cmd)
68 { 70 {
69 SqliteConnection newConnection = 71 lock (m_lockObject)
70 (SqliteConnection)((ICloneable)m_Connection).Clone(); 72 {
71 newConnection.Open(); 73 SqliteConnection newConnection =
74 (SqliteConnection)((ICloneable)m_Connection).Clone();
75 newConnection.Open();
72 76
73 cmd.Connection = newConnection; 77 cmd.Connection = newConnection;
74 Console.WriteLine("XXX " + cmd.CommandText); 78 Console.WriteLine("XXX " + cmd.CommandText);
75 return cmd.ExecuteReader(); 79 return cmd.ExecuteReader();
80 }
76 } 81 }
77 82
78 protected void CloseReaderCommand(SqliteCommand cmd) 83 protected void CloseReaderCommand(SqliteCommand cmd)
79 { 84 {
80 cmd.Connection.Close(); 85 lock (m_lockObject)
81 cmd.Connection.Dispose(); 86 {
82 cmd.Dispose(); 87 cmd.Connection.Close();
88 cmd.Connection.Dispose();
89 cmd.Dispose();
90 }
83 } 91 }
84 } 92 }
85} 93}