aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLFramework.cs
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-05 16:39:40 -0700
committerJohn Hurliman2009-10-05 16:39:40 -0700
commit672036937671a69426a12936c69efcb54d029e86 (patch)
tree25c322d9a2bad9f9cce2fff3569cbc0074304f33 /OpenSim/Data/MySQL/MySQLFramework.cs
parentMake sure that keys exist in arrays before trying to access them. (diff)
downloadopensim-SC_OLD-672036937671a69426a12936c69efcb54d029e86.zip
opensim-SC_OLD-672036937671a69426a12936c69efcb54d029e86.tar.gz
opensim-SC_OLD-672036937671a69426a12936c69efcb54d029e86.tar.bz2
opensim-SC_OLD-672036937671a69426a12936c69efcb54d029e86.tar.xz
Added CloseDBConnection() to replace the old CloseReaderCommand(). This will close the MySQLConnection attached to a MySQLCommand. I'm not sure if this accounts for every time a database connection needs to be closed, but it matches up 1:1 with the places where the database connection was previously being closed
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLFramework.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLFramework.cs14
1 files changed, 7 insertions, 7 deletions
diff --git a/OpenSim/Data/MySQL/MySQLFramework.cs b/OpenSim/Data/MySQL/MySQLFramework.cs
index c756c9c..f37e9bc 100644
--- a/OpenSim/Data/MySQL/MySQLFramework.cs
+++ b/OpenSim/Data/MySQL/MySQLFramework.cs
@@ -47,7 +47,6 @@ namespace OpenSim.Data.MySQL
47 protected MySqlFramework(string connectionString) 47 protected MySqlFramework(string connectionString)
48 { 48 {
49 m_Connection = new MySqlConnection(connectionString); 49 m_Connection = new MySqlConnection(connectionString);
50
51 m_Connection.Open(); 50 m_Connection.Open();
52 } 51 }
53 52
@@ -82,8 +81,7 @@ namespace OpenSim.Data.MySQL
82 errorSeen = true; 81 errorSeen = true;
83 82
84 m_Connection.Close(); 83 m_Connection.Close();
85 MySqlConnection newConnection = (MySqlConnection) 84 MySqlConnection newConnection = (MySqlConnection)((ICloneable)m_Connection).Clone();
86 ((ICloneable)m_Connection).Clone();
87 m_Connection.Dispose(); 85 m_Connection.Dispose();
88 m_Connection = newConnection; 86 m_Connection = newConnection;
89 m_Connection.Open(); 87 m_Connection.Open();
@@ -104,14 +102,16 @@ namespace OpenSim.Data.MySQL
104 102
105 protected IDataReader ExecuteReader(MySqlCommand cmd) 103 protected IDataReader ExecuteReader(MySqlCommand cmd)
106 { 104 {
107 MySqlConnection newConnection = (MySqlConnection) 105 MySqlConnection newConnection = (MySqlConnection)((ICloneable)m_Connection).Clone();
108 ((ICloneable)m_Connection).Clone();
109
110 newConnection.Open(); 106 newConnection.Open();
111 107
112 cmd.Connection = newConnection; 108 cmd.Connection = newConnection;
113
114 return cmd.ExecuteReader(); 109 return cmd.ExecuteReader();
115 } 110 }
111
112 protected void CloseDBConnection(MySqlCommand cmd)
113 {
114 cmd.Connection.Dispose();
115 }
116 } 116 }
117} 117}