From bc6995f92123ff29fdfd6f811d3d252d99284527 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 9 May 2010 18:02:36 +0100 Subject: [PATCH] Add Delete handler to SQLite (NG) --- OpenSim/Data/SQLite/SQLiteAssetData.cs | 31 +++++++++++++------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 9b938fab73..2783ba1556 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -207,20 +207,6 @@ namespace OpenSim.Data.SQLite } } - /// - /// Delete an asset from database - /// - /// - public void DeleteAsset(UUID uuid) - { - using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn)) - { - cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString())); - - cmd.ExecuteNonQuery(); - } - } - /// /// /// @@ -340,7 +326,22 @@ namespace OpenSim.Data.SQLite 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