* MySQL data tests now pass by fixing a bad fix for a bad cast on the asset Local member in MySQLAssetData

* First pass at applying the using(){} pattern to IDisposable objects. Always use the using pattern on IDisposable objects whenever possible, do not manually call .Close() or .Dispose() unless there is no other way to write the code. This pass mostly covers OpenSim.Data.MySQL, and should have no functional change (tests still pass)
This commit is contained in:
John Hurliman
2009-10-04 13:57:51 -07:00
parent d93e0a0503
commit 29a4614529
18 changed files with 1193 additions and 1312 deletions

View File

@@ -40,6 +40,8 @@ namespace OpenSim.Data.MySQL
/// </summary>
public class MySqlFramework
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected MySqlConnection m_Connection;
protected MySqlFramework(string connectionString)
@@ -70,12 +72,11 @@ namespace OpenSim.Data.MySQL
}
catch (MySqlException e)
{
Console.WriteLine(e.ToString());
m_log.Error(e.Message, e);
if (errorSeen)
throw;
// This is "Server has gone away" and "Server lost"
//
if (e.Number == 2006 || e.Number == 2013)
{
errorSeen = true;
@@ -94,7 +95,7 @@ Console.WriteLine(e.ToString());
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
m_log.Error(e.Message, e);
return 0;
}
}
@@ -112,12 +113,5 @@ Console.WriteLine(e.ToString());
return cmd.ExecuteReader();
}
protected void CloseReaderCommand(MySqlCommand cmd)
{
cmd.Connection.Close();
cmd.Connection.Dispose();
cmd.Dispose();
}
}
}