aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLFramework.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLFramework.cs40
1 files changed, 29 insertions, 11 deletions
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs
index 5820a90..34791cf 100644
--- a/OpenSim/Data/MySQL/MySQLFramework.cs
+++ b/OpenSim/Data/MySQL/MySQLFramework.cs
@@ -45,27 +45,45 @@ 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();
48 49
49 protected MySqlFramework(string connectionString) 50 protected MySqlFramework(string connectionString)
50 { 51 {
51 m_connectionString = connectionString; 52 m_connectionString = connectionString;
52 } 53 }
53 54
55 //////////////////////////////////////////////////////////////
56 //
57 // All non queries are funneled through one connection
58 // to increase performance a little
59 //
54 protected int ExecuteNonQuery(MySqlCommand cmd) 60 protected int ExecuteNonQuery(MySqlCommand cmd)
55 { 61 {
56 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 62 lock (m_dbLock)
57 { 63 {
58 dbcon.Open(); 64 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
59 cmd.Connection = dbcon;
60
61 try
62 {
63 return cmd.ExecuteNonQuery();
64 }
65 catch (Exception e)
66 { 65 {
67 m_log.Error(e.Message, e); 66 try
68 return 0; 67 {
68 dbcon.Open();
69 cmd.Connection = dbcon;
70
71 try
72 {
73 return cmd.ExecuteNonQuery();
74 }
75 catch (Exception e)
76 {
77 m_log.Error(e.Message, e);
78 m_log.Error(Environment.StackTrace.ToString());
79 return 0;
80 }
81 }
82 catch (Exception e)
83 {
84 m_log.Error(e.Message, e);
85 return 0;
86 }
69 } 87 }
70 } 88 }
71 } 89 }