remove redundant using(){}
parent
2d88e4cf73
commit
0a67cda224
|
@ -160,12 +160,6 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
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;
|
string assetName = asset.Name;
|
||||||
if (asset.Name.Length > AssetBase.MAX_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);
|
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
|
// create unix epoch time
|
||||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||||
|
@ -204,8 +202,6 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
|
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))
|
= new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
|
||||||
using (cmd)
|
|
||||||
{
|
{
|
||||||
// create unix epoch time
|
// create unix epoch time
|
||||||
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
|
||||||
|
@ -235,7 +229,6 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.AddWithValue("?access_time", now);
|
cmd.Parameters.AddWithValue("?access_time", now);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error(
|
m_log.Error(
|
||||||
|
|
Loading…
Reference in New Issue