mirror of
https://github.com/opensim/opensim.git
synced 2026-06-29 02:25:39 +08:00
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
This commit is contained in:
@@ -47,7 +47,6 @@ namespace OpenSim.Data.MySQL
|
||||
protected MySqlFramework(string connectionString)
|
||||
{
|
||||
m_Connection = new MySqlConnection(connectionString);
|
||||
|
||||
m_Connection.Open();
|
||||
}
|
||||
|
||||
@@ -82,8 +81,7 @@ namespace OpenSim.Data.MySQL
|
||||
errorSeen = true;
|
||||
|
||||
m_Connection.Close();
|
||||
MySqlConnection newConnection = (MySqlConnection)
|
||||
((ICloneable)m_Connection).Clone();
|
||||
MySqlConnection newConnection = (MySqlConnection)((ICloneable)m_Connection).Clone();
|
||||
m_Connection.Dispose();
|
||||
m_Connection = newConnection;
|
||||
m_Connection.Open();
|
||||
@@ -104,14 +102,16 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
protected IDataReader ExecuteReader(MySqlCommand cmd)
|
||||
{
|
||||
MySqlConnection newConnection = (MySqlConnection)
|
||||
((ICloneable)m_Connection).Clone();
|
||||
|
||||
MySqlConnection newConnection = (MySqlConnection)((ICloneable)m_Connection).Clone();
|
||||
newConnection.Open();
|
||||
|
||||
cmd.Connection = newConnection;
|
||||
|
||||
return cmd.ExecuteReader();
|
||||
}
|
||||
|
||||
protected void CloseDBConnection(MySqlCommand cmd)
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user