aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteFramework.cs
diff options
context:
space:
mode:
authorMelanie2010-03-03 02:07:03 +0000
committerMelanie2010-03-03 02:07:03 +0000
commit028a87fe37002e7a0611f66babf1deee46c83804 (patch)
tree387aec499fd60c2012bed8148e6a2ddc847c3d95 /OpenSim/Data/SQLite/SQLiteFramework.cs
parentRevert "test" (diff)
parentFixes Region.Framework tests. Although these tests don't fail, they need to b... (diff)
downloadopensim-SC_OLD-028a87fe37002e7a0611f66babf1deee46c83804.zip
opensim-SC_OLD-028a87fe37002e7a0611f66babf1deee46c83804.tar.gz
opensim-SC_OLD-028a87fe37002e7a0611f66babf1deee46c83804.tar.bz2
opensim-SC_OLD-028a87fe37002e7a0611f66babf1deee46c83804.tar.xz
Merge branch 'master' into careminster-presence-refactor
This brings careminster on the level of master. To be tested
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteFramework.cs')
-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 12b2750..20b5085 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 //////////////////////////////////////////////////////////////
@@ -53,27 +51,37 @@ namespace OpenSim.Data.SQLite
53 // All non queries are funneled through one connection 51 // All non queries are funneled through one connection
54 // to increase performance a little 52 // to increase performance a little
55 // 53 //
56 protected int ExecuteNonQuery(SqliteCommand cmd) 54 protected int ExecuteNonQuery(SqliteCommand cmd, SqliteConnection connection)
57 { 55 {
58 lock (m_Connection) 56 lock (connection)
59 { 57 {
60 cmd.Connection = m_Connection; 58 SqliteConnection newConnection =
59 (SqliteConnection)((ICloneable)connection).Clone();
60 newConnection.Open();
61
62 cmd.Connection = newConnection;
63 //Console.WriteLine("XXX " + cmd.CommandText);
61 64
62 return cmd.ExecuteNonQuery(); 65 return cmd.ExecuteNonQuery();
63 } 66 }
64 } 67 }
65 68
66 protected IDataReader ExecuteReader(SqliteCommand cmd) 69 protected IDataReader ExecuteReader(SqliteCommand cmd, SqliteConnection connection)
67 { 70 {
68 SqliteConnection newConnection = 71 lock (connection)
69 (SqliteConnection)((ICloneable)m_Connection).Clone(); 72 {
70 newConnection.Open(); 73 SqliteConnection newConnection =
74 (SqliteConnection)((ICloneable)connection).Clone();
75 newConnection.Open();
71 76
72 cmd.Connection = newConnection; 77 cmd.Connection = newConnection;
73 return cmd.ExecuteReader(); 78 //Console.WriteLine("XXX " + cmd.CommandText);
79
80 return cmd.ExecuteReader();
81 }
74 } 82 }
75 83
76 protected void CloseReaderCommand(SqliteCommand cmd) 84 protected void CloseCommand(SqliteCommand cmd)
77 { 85 {
78 cmd.Connection.Close(); 86 cmd.Connection.Close();
79 cmd.Connection.Dispose(); 87 cmd.Connection.Dispose();