aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-02-21 04:20:22 +0000
committerMelanie2010-02-21 04:20:22 +0000
commitd761d1624b28a9ab3b006b3a3a94f4b805550f8c (patch)
treeb4d9c08eb89793cc62cfb21940530602e4d69fd5 /OpenSim
parentReverted SQLite/SQLiteGenericTableHandler to what it was + singleton. (diff)
downloadopensim-SC_OLD-d761d1624b28a9ab3b006b3a3a94f4b805550f8c.zip
opensim-SC_OLD-d761d1624b28a9ab3b006b3a3a94f4b805550f8c.tar.gz
opensim-SC_OLD-d761d1624b28a9ab3b006b3a3a94f4b805550f8c.tar.bz2
opensim-SC_OLD-d761d1624b28a9ab3b006b3a3a94f4b805550f8c.tar.xz
Fix SQLite locking and make it more fascist for now
Diffstat (limited to 'OpenSim')
-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}