aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs')
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs29
1 files changed, 26 insertions, 3 deletions
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 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using System.Reflection;
4 5
5using OpenSim.Framework.Console; 6using OpenSim.Framework.Console;
6using OpenSim.Framework.Types; 7using OpenSim.Framework.Types;
@@ -166,7 +167,12 @@ namespace OpenSim.Framework.Data.SQLite
166 /// <returns>A string containing the plugin version</returns> 167 /// <returns>A string containing the plugin version</returns>
167 public string getVersion() 168 public string getVersion()
168 { 169 {
169 return "0.1"; 170 System.Reflection.Module module = this.GetType().Module;
171 string dllName = module.Assembly.ManifestModule.Name;
172 Version dllVersion = module.Assembly.GetName().Version;
173
174
175 return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision);
170 } 176 }
171 177
172 /// <summary> 178 /// <summary>
@@ -337,11 +343,11 @@ namespace OpenSim.Framework.Data.SQLite
337 /// 343 ///
338 /// </summary> 344 /// </summary>
339 /// <param name="item"></param> 345 /// <param name="item"></param>
340 public void deleteInventoryItem(InventoryItemBase item) 346 public void deleteInventoryItem(LLUUID itemID)
341 { 347 {
342 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 348 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
343 349
344 DataRow inventoryRow = inventoryItemTable.Rows.Find(item.inventoryID); 350 DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID);
345 if (inventoryRow != null) 351 if (inventoryRow != null)
346 { 352 {
347 inventoryRow.Delete(); 353 inventoryRow.Delete();
@@ -350,6 +356,20 @@ namespace OpenSim.Framework.Data.SQLite
350 this.invItemsDa.Update(ds, "inventoryitems"); 356 this.invItemsDa.Update(ds, "inventoryitems");
351 } 357 }
352 358
359
360 /// <summary>
361 /// Delete all items in the specified folder
362 /// </summary>
363 /// <param name="folderId">id of the folder, whose item content should be deleted</param>
364 //!TODO, this is horribly inefficient, but I don't want to ruin the overall structure of this implementatio
365 private void deleteItemsInFolder(LLUUID folderId)
366 {
367 List<InventoryItemBase> items = getInventoryInFolder(folderId);
368
369 foreach(InventoryItemBase i in items)
370 deleteInventoryItem(i.inventoryID);
371 }
372
353 /// <summary> 373 /// <summary>
354 /// Adds a new folder specified by folder 374 /// Adds a new folder specified by folder
355 /// </summary> 375 /// </summary>
@@ -389,6 +409,7 @@ namespace OpenSim.Framework.Data.SQLite
389 inventoryRow = inventoryFolderTable.Rows.Find(f.folderID); 409 inventoryRow = inventoryFolderTable.Rows.Find(f.folderID);
390 if (inventoryRow != null) 410 if (inventoryRow != null)
391 { 411 {
412 deleteItemsInFolder(f.folderID);
392 inventoryRow.Delete(); 413 inventoryRow.Delete();
393 } 414 }
394 } 415 }
@@ -397,6 +418,7 @@ namespace OpenSim.Framework.Data.SQLite
397 inventoryRow = inventoryFolderTable.Rows.Find(folderID); 418 inventoryRow = inventoryFolderTable.Rows.Find(folderID);
398 if (inventoryRow != null) 419 if (inventoryRow != null)
399 { 420 {
421 deleteItemsInFolder(folderID);
400 inventoryRow.Delete(); 422 inventoryRow.Delete();
401 } 423 }
402 424
@@ -554,3 +576,4 @@ namespace OpenSim.Framework.Data.SQLite
554} 576}
555 577
556 578
579