aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/MySQL/MySQLFramework.cs33
1 files changed, 12 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs
index 3fdcf1e..5820a90 100644
--- a/OpenSim/Data/MySQL/MySQLFramework.cs
+++ b/OpenSim/Data/MySQL/MySQLFramework.cs
@@ -45,38 +45,29 @@ namespace OpenSim.Data.MySQL
45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 45 System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 protected string m_connectionString; 47 protected string m_connectionString;
48 protected object m_dbLock = new object();
49 48
50 protected MySqlFramework(string connectionString) 49 protected MySqlFramework(string connectionString)
51 { 50 {
52 m_connectionString = connectionString; 51 m_connectionString = connectionString;
53 } 52 }
54 53
55 //////////////////////////////////////////////////////////////
56 //
57 // All non queries are funneled through one connection
58 // to increase performance a little
59 //
60 protected int ExecuteNonQuery(MySqlCommand cmd) 54 protected int ExecuteNonQuery(MySqlCommand cmd)
61 { 55 {
62 lock (m_dbLock) 56 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
63 { 57 {
64 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 58 dbcon.Open();
65 { 59 cmd.Connection = dbcon;
66 dbcon.Open();
67 cmd.Connection = dbcon;
68 60
69 try 61 try
70 { 62 {
71 return cmd.ExecuteNonQuery(); 63 return cmd.ExecuteNonQuery();
72 } 64 }
73 catch (Exception e) 65 catch (Exception e)
74 { 66 {
75 m_log.Error(e.Message, e); 67 m_log.Error(e.Message, e);
76 return 0; 68 return 0;
77 }
78 } 69 }
79 } 70 }
80 } 71 }
81 } 72 }
82} 73} \ No newline at end of file