aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteFramework.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteFramework.cs42
1 files changed, 27 insertions, 15 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs
index 12b2750..cf114d1 100644
--- a/OpenSim/Data/SQLite/SQLiteFramework.cs
+++ b/OpenSim/Data/SQLite/SQLiteFramework.cs
@@ -31,7 +31,7 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using Mono.Data.SqliteClient; 34using Mono.Data.Sqlite;
35 35
36namespace OpenSim.Data.SQLite 36namespace OpenSim.Data.SQLite
37{ 37{
@@ -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,41 @@ 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/*
59 SqliteConnection newConnection =
60 (SqliteConnection)((ICloneable)connection).Clone();
61 newConnection.Open();
62
63 cmd.Connection = newConnection;
64*/
65 cmd.Connection = connection;
66 //Console.WriteLine("XXX " + cmd.CommandText);
61 67
62 return cmd.ExecuteNonQuery(); 68 return cmd.ExecuteNonQuery();
63 } 69 }
64 } 70 }
65 71
66 protected IDataReader ExecuteReader(SqliteCommand cmd) 72 protected IDataReader ExecuteReader(SqliteCommand cmd, SqliteConnection connection)
67 { 73 {
68 SqliteConnection newConnection = 74 lock (connection)
69 (SqliteConnection)((ICloneable)m_Connection).Clone(); 75 {
70 newConnection.Open(); 76 //SqliteConnection newConnection =
77 // (SqliteConnection)((ICloneable)connection).Clone();
78 //newConnection.Open();
79
80 //cmd.Connection = newConnection;
81 cmd.Connection = connection;
82 //Console.WriteLine("XXX " + cmd.CommandText);
71 83
72 cmd.Connection = newConnection; 84 return cmd.ExecuteReader();
73 return cmd.ExecuteReader(); 85 }
74 } 86 }
75 87
76 protected void CloseReaderCommand(SqliteCommand cmd) 88 protected void CloseCommand(SqliteCommand cmd)
77 { 89 {
78 cmd.Connection.Close(); 90 cmd.Connection.Close();
79 cmd.Connection.Dispose(); 91 cmd.Connection.Dispose();