aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteFramework.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteFramework.cs31
1 files changed, 14 insertions, 17 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs
index 54b104b..20b5085 100644
--- a/OpenSim/Data/SQLite/SQLiteFramework.cs
+++ b/OpenSim/Data/SQLite/SQLiteFramework.cs
@@ -42,7 +42,6 @@ namespace OpenSim.Data.SQLite
42 { 42 {
43 protected Object m_lockObject = new Object(); 43 protected Object m_lockObject = new Object();
44 44
45 protected static SqliteConnection m_Connection;
46 protected SQLiteFramework(string connectionString) 45 protected SQLiteFramework(string connectionString)
47 { 46 {
48 } 47 }
@@ -52,43 +51,41 @@ namespace OpenSim.Data.SQLite
52 // All non queries are funneled through one connection 51 // All non queries are funneled through one connection
53 // to increase performance a little 52 // to increase performance a little
54 // 53 //
55 protected int ExecuteNonQuery(SqliteCommand cmd) 54 protected int ExecuteNonQuery(SqliteCommand cmd, SqliteConnection connection)
56 { 55 {
57 lock (m_lockObject) 56 lock (connection)
58 { 57 {
59 SqliteConnection newConnection = 58 SqliteConnection newConnection =
60 (SqliteConnection)((ICloneable)m_Connection).Clone(); 59 (SqliteConnection)((ICloneable)connection).Clone();
61 newConnection.Open(); 60 newConnection.Open();
62 61
63 cmd.Connection = newConnection; 62 cmd.Connection = newConnection;
64 Console.WriteLine("XXX " + cmd.CommandText); 63 //Console.WriteLine("XXX " + cmd.CommandText);
65 64
66 return cmd.ExecuteNonQuery(); 65 return cmd.ExecuteNonQuery();
67 } 66 }
68 } 67 }
69 68
70 protected IDataReader ExecuteReader(SqliteCommand cmd) 69 protected IDataReader ExecuteReader(SqliteCommand cmd, SqliteConnection connection)
71 { 70 {
72 lock (m_lockObject) 71 lock (connection)
73 { 72 {
74 SqliteConnection newConnection = 73 SqliteConnection newConnection =
75 (SqliteConnection)((ICloneable)m_Connection).Clone(); 74 (SqliteConnection)((ICloneable)connection).Clone();
76 newConnection.Open(); 75 newConnection.Open();
77 76
78 cmd.Connection = newConnection; 77 cmd.Connection = newConnection;
79 Console.WriteLine("XXX " + cmd.CommandText); 78 //Console.WriteLine("XXX " + cmd.CommandText);
79
80 return cmd.ExecuteReader(); 80 return cmd.ExecuteReader();
81 } 81 }
82 } 82 }
83 83
84 protected void CloseReaderCommand(SqliteCommand cmd) 84 protected void CloseCommand(SqliteCommand cmd)
85 { 85 {
86 lock (m_lockObject) 86 cmd.Connection.Close();
87 { 87 cmd.Connection.Dispose();
88 cmd.Connection.Close(); 88 cmd.Dispose();
89 cmd.Connection.Dispose();
90 cmd.Dispose();
91 }
92 } 89 }
93 } 90 }
94} 91}