remove redundant using(){}

avinationmerge
UbitUmarov 2015-09-15 06:28:21 +01:00
parent 2d88e4cf73
commit 0a67cda224
1 changed files with 40 additions and 47 deletions

View File

@ -160,12 +160,6 @@ namespace OpenSim.Data.MySQL
{
dbcon.Open();
using (MySqlCommand cmd =
new MySqlCommand(
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
dbcon))
{
string assetName = asset.Name;
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
{
@ -184,9 +178,13 @@ namespace OpenSim.Data.MySQL
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
}
try
using (MySqlCommand cmd =
new MySqlCommand(
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
dbcon))
{
using (cmd)
try
{
// create unix epoch time
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
@ -204,8 +202,6 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
return true;
}
}
catch (Exception e)
{
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
@ -226,8 +222,6 @@ namespace OpenSim.Data.MySQL
= new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon))
{
try
{
using (cmd)
{
// create unix epoch time
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
@ -235,7 +229,6 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?access_time", now);
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.Error(