From 60357d3778c95a47481f790803b7af39c70cde9c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 9 May 2010 17:56:52 +0100 Subject: Implement the "delete" path for assets. Adds a new option to allow remote asset deletion in robust handler. --- OpenSim/Data/AssetDataBase.cs | 1 + OpenSim/Data/IAssetData.cs | 1 + OpenSim/Data/MSSQL/MSSQLAssetData.cs | 4 ++++ OpenSim/Data/MySQL/MySQLAssetData.cs | 18 ++++++++++++++++++ OpenSim/Data/SQLite/SQLiteAssetData.cs | 5 +++++ OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs | 6 +++++- 6 files changed, 34 insertions(+), 1 deletion(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs index 5deb44e..e1a810c 100644 --- a/OpenSim/Data/AssetDataBase.cs +++ b/OpenSim/Data/AssetDataBase.cs @@ -48,5 +48,6 @@ namespace OpenSim.Data public abstract void Initialise(string connect); public abstract void Initialise(); public abstract void Dispose(); + public abstract bool Delete(string id); } } diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs index 2149bca..90d5eeb 100644 --- a/OpenSim/Data/IAssetData.cs +++ b/OpenSim/Data/IAssetData.cs @@ -38,6 +38,7 @@ namespace OpenSim.Data bool ExistsAsset(UUID uuid); List FetchAssetMetadataSet(int start, int count); void Initialise(string connect); + bool Delete(string id); } public class AssetDataInitialiser : PluginInitialiserBase diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index d6ea262..8475b22 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -322,6 +322,10 @@ namespace OpenSim.Data.MSSQL return retList; } + public override bool Delete(string id) + { + return false; + } #endregion } } diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 5a2af4f..35eed56 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -338,6 +338,24 @@ namespace OpenSim.Data.MySQL return retList; } + public override bool Delete(string id) + { + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id"); + cmd.Parameters.AddWithValue("?id", id); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + } + } + + return true; + } + #endregion } } diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 636bf86..9b938fa 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -338,6 +338,11 @@ namespace OpenSim.Data.SQLite get { return "SQLite Asset storage engine"; } } + public override bool Delete(string id) + { + return false; + } + #endregion } } diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs index 0d63dea..df50902 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs @@ -338,6 +338,10 @@ namespace OpenSim.Data.SQLiteLegacy get { return "SQLite Asset storage engine"; } } + public override bool Delete(string id) + { + return false; + } #endregion } -} \ No newline at end of file +} -- cgit v1.1