Add Delete handler to SQLite (NG)

slimupdates2
Melanie 2010-05-09 18:02:36 +01:00
parent 60357d3778
commit bc6995f921
1 changed files with 16 additions and 15 deletions

View File

@ -207,20 +207,6 @@ namespace OpenSim.Data.SQLite
} }
} }
/// <summary>
/// Delete an asset from database
/// </summary>
/// <param name="uuid"></param>
public void DeleteAsset(UUID uuid)
{
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
cmd.ExecuteNonQuery();
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -340,7 +326,22 @@ namespace OpenSim.Data.SQLite
public override bool Delete(string id) public override bool Delete(string id)
{ {
return false; UUID assetID;
if (!UUID.TryParse(id, out assetID))
return false;
lock (this)
{
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":UUID", assetID.ToString()));
cmd.ExecuteNonQuery();
}
}
return true;
} }
#endregion #endregion