From 4c25008850f92bcc79502c71a0e4d34c883d27d0 Mon Sep 17 00:00:00 2001
From: MW
Date: Mon, 8 Oct 2007 10:30:15 +0000
Subject: Applied patch 485, inventory patch from tleiades (thanks again).
---
.../Framework/Data.SQLite/SQLiteInventoryStore.cs | 29 +++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs')
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index 4c9c467..1688b709 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using System.Reflection;
using OpenSim.Framework.Console;
using OpenSim.Framework.Types;
@@ -166,7 +167,12 @@ namespace OpenSim.Framework.Data.SQLite
/// A string containing the plugin version
public string getVersion()
{
- return "0.1";
+ System.Reflection.Module module = this.GetType().Module;
+ string dllName = module.Assembly.ManifestModule.Name;
+ Version dllVersion = module.Assembly.GetName().Version;
+
+
+ return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision);
}
///
@@ -337,11 +343,11 @@ namespace OpenSim.Framework.Data.SQLite
///
///
///
- public void deleteInventoryItem(InventoryItemBase item)
+ public void deleteInventoryItem(LLUUID itemID)
{
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
- DataRow inventoryRow = inventoryItemTable.Rows.Find(item.inventoryID);
+ DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID);
if (inventoryRow != null)
{
inventoryRow.Delete();
@@ -350,6 +356,20 @@ namespace OpenSim.Framework.Data.SQLite
this.invItemsDa.Update(ds, "inventoryitems");
}
+
+ ///
+ /// Delete all items in the specified folder
+ ///
+ /// id of the folder, whose item content should be deleted
+ //!TODO, this is horribly inefficient, but I don't want to ruin the overall structure of this implementatio
+ private void deleteItemsInFolder(LLUUID folderId)
+ {
+ List items = getInventoryInFolder(folderId);
+
+ foreach(InventoryItemBase i in items)
+ deleteInventoryItem(i.inventoryID);
+ }
+
///
/// Adds a new folder specified by folder
///
@@ -389,6 +409,7 @@ namespace OpenSim.Framework.Data.SQLite
inventoryRow = inventoryFolderTable.Rows.Find(f.folderID);
if (inventoryRow != null)
{
+ deleteItemsInFolder(f.folderID);
inventoryRow.Delete();
}
}
@@ -397,6 +418,7 @@ namespace OpenSim.Framework.Data.SQLite
inventoryRow = inventoryFolderTable.Rows.Find(folderID);
if (inventoryRow != null)
{
+ deleteItemsInFolder(folderID);
inventoryRow.Delete();
}
@@ -554,3 +576,4 @@ namespace OpenSim.Framework.Data.SQLite
}
+
--
cgit v1.1