aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteInventoryStore.cs')
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs54
1 files changed, 27 insertions, 27 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 4c35ac2..ca7e612 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -29,7 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Reflection; 31using System.Reflection;
32using libsecondlife; 32using OpenMetaverse;
33using log4net; 33using log4net;
34using Mono.Data.SqliteClient; 34using Mono.Data.SqliteClient;
35using OpenSim.Framework; 35using OpenSim.Framework;
@@ -109,13 +109,13 @@ namespace OpenSim.Data.SQLite
109 public InventoryItemBase buildItem(DataRow row) 109 public InventoryItemBase buildItem(DataRow row)
110 { 110 {
111 InventoryItemBase item = new InventoryItemBase(); 111 InventoryItemBase item = new InventoryItemBase();
112 item.ID = new LLUUID((string) row["UUID"]); 112 item.ID = new UUID((string) row["UUID"]);
113 item.AssetID = new LLUUID((string) row["assetID"]); 113 item.AssetID = new UUID((string) row["assetID"]);
114 item.AssetType = Convert.ToInt32(row["assetType"]); 114 item.AssetType = Convert.ToInt32(row["assetType"]);
115 item.InvType = Convert.ToInt32(row["invType"]); 115 item.InvType = Convert.ToInt32(row["invType"]);
116 item.Folder = new LLUUID((string) row["parentFolderID"]); 116 item.Folder = new UUID((string) row["parentFolderID"]);
117 item.Owner = new LLUUID((string) row["avatarID"]); 117 item.Owner = new UUID((string) row["avatarID"]);
118 item.Creator = new LLUUID((string) row["creatorsID"]); 118 item.Creator = new UUID((string) row["creatorsID"]);
119 item.Name = (string) row["inventoryName"]; 119 item.Name = (string) row["inventoryName"];
120 item.Description = (string) row["inventoryDescription"]; 120 item.Description = (string) row["inventoryDescription"];
121 121
@@ -135,7 +135,7 @@ namespace OpenSim.Data.SQLite
135 item.CreationDate = Convert.ToInt32(row["creationDate"]); 135 item.CreationDate = Convert.ToInt32(row["creationDate"]);
136 136
137 if (!Convert.IsDBNull(row["groupID"])) 137 if (!Convert.IsDBNull(row["groupID"]))
138 item.GroupID = new LLUUID((string)row["groupID"]); 138 item.GroupID = new UUID((string)row["groupID"]);
139 139
140 if (!Convert.IsDBNull(row["groupOwned"])) 140 if (!Convert.IsDBNull(row["groupOwned"]))
141 item.GroupOwned = Convert.ToBoolean(row["groupOwned"]); 141 item.GroupOwned = Convert.ToBoolean(row["groupOwned"]);
@@ -317,7 +317,7 @@ namespace OpenSim.Data.SQLite
317 /// </summary> 317 /// </summary>
318 /// <param name="folderID">The UUID of the target folder</param> 318 /// <param name="folderID">The UUID of the target folder</param>
319 /// <returns>A List of InventoryItemBase items</returns> 319 /// <returns>A List of InventoryItemBase items</returns>
320 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) 320 public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
321 { 321 {
322 lock (ds) 322 lock (ds)
323 { 323 {
@@ -339,20 +339,20 @@ namespace OpenSim.Data.SQLite
339 /// </summary> 339 /// </summary>
340 /// <param name="user">The user whos inventory is to be searched</param> 340 /// <param name="user">The user whos inventory is to be searched</param>
341 /// <returns>A list of folder objects</returns> 341 /// <returns>A list of folder objects</returns>
342 public List<InventoryFolderBase> getUserRootFolders(LLUUID user) 342 public List<InventoryFolderBase> getUserRootFolders(UUID user)
343 { 343 {
344 return new List<InventoryFolderBase>(); 344 return new List<InventoryFolderBase>();
345 } 345 }
346 346
347 // see InventoryItemBase.getUserRootFolder 347 // see InventoryItemBase.getUserRootFolder
348 public InventoryFolderBase getUserRootFolder(LLUUID user) 348 public InventoryFolderBase getUserRootFolder(UUID user)
349 { 349 {
350 lock (ds) 350 lock (ds)
351 { 351 {
352 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 352 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
353 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 353 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
354 string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" + 354 string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" +
355 Util.ToRawUuidString(LLUUID.Zero) + "'"; 355 Util.ToRawUuidString(UUID.Zero) + "'";
356 DataRow[] rows = inventoryFolderTable.Select(selectExp); 356 DataRow[] rows = inventoryFolderTable.Select(selectExp);
357 foreach (DataRow row in rows) 357 foreach (DataRow row in rows)
358 { 358 {
@@ -378,7 +378,7 @@ namespace OpenSim.Data.SQLite
378 /// </summary> 378 /// </summary>
379 /// <param name="folders">list where folders will be appended</param> 379 /// <param name="folders">list where folders will be appended</param>
380 /// <param name="parentID">ID of parent</param> 380 /// <param name="parentID">ID of parent</param>
381 protected void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID) 381 protected void getInventoryFolders(ref List<InventoryFolderBase> folders, UUID parentID)
382 { 382 {
383 lock (ds) 383 lock (ds)
384 { 384 {
@@ -398,7 +398,7 @@ namespace OpenSim.Data.SQLite
398 /// </summary> 398 /// </summary>
399 /// <param name="parentID">The folder to get subfolders for</param> 399 /// <param name="parentID">The folder to get subfolders for</param>
400 /// <returns>A list of inventory folders</returns> 400 /// <returns>A list of inventory folders</returns>
401 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) 401 public List<InventoryFolderBase> getInventoryFolders(UUID parentID)
402 { 402 {
403 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 403 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
404 getInventoryFolders(ref folders, Util.ToRawUuidString(parentID)); 404 getInventoryFolders(ref folders, Util.ToRawUuidString(parentID));
@@ -410,7 +410,7 @@ namespace OpenSim.Data.SQLite
410 /// </summary> 410 /// </summary>
411 /// <param name="parentID"></param> 411 /// <param name="parentID"></param>
412 /// <returns></returns> 412 /// <returns></returns>
413 public List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID) 413 public List<InventoryFolderBase> getFolderHierarchy(UUID parentID)
414 { 414 {
415 /* Note: There are subtle changes between this implementation of getFolderHierarchy and the previous one 415 /* Note: There are subtle changes between this implementation of getFolderHierarchy and the previous one
416 * - We will only need to hit the database twice instead of n times. 416 * - We will only need to hit the database twice instead of n times.
@@ -441,7 +441,7 @@ namespace OpenSim.Data.SQLite
441 if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist 441 if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist
442 { 442 {
443 parentFolder = buildFolder(parentRow[0]); 443 parentFolder = buildFolder(parentRow[0]);
444 LLUUID agentID = parentFolder.Owner; 444 UUID agentID = parentFolder.Owner;
445 selectExp = "agentID = '" + Util.ToRawUuidString(agentID) + "'"; 445 selectExp = "agentID = '" + Util.ToRawUuidString(agentID) + "'";
446 folderRows = inventoryFolderTable.Select(selectExp); 446 folderRows = inventoryFolderTable.Select(selectExp);
447 } 447 }
@@ -451,7 +451,7 @@ namespace OpenSim.Data.SQLite
451 /* if we're querying the root folder, just return an unordered list of all folders in the user's 451 /* if we're querying the root folder, just return an unordered list of all folders in the user's
452 * inventory 452 * inventory
453 */ 453 */
454 if (parentFolder.ParentID == LLUUID.Zero) 454 if (parentFolder.ParentID == UUID.Zero)
455 { 455 {
456 foreach (DataRow row in folderRows) 456 foreach (DataRow row in folderRows)
457 { 457 {
@@ -470,13 +470,13 @@ namespace OpenSim.Data.SQLite
470 { // Querying a non-root folder 470 { // Querying a non-root folder
471 471
472 // Build a hash table of all user's inventory folders, indexed by each folder's parent ID 472 // Build a hash table of all user's inventory folders, indexed by each folder's parent ID
473 Dictionary<LLUUID, List<InventoryFolderBase>> hashtable = 473 Dictionary<UUID, List<InventoryFolderBase>> hashtable =
474 new Dictionary<LLUUID, List<InventoryFolderBase>>(folderRows.GetLength(0)); 474 new Dictionary<UUID, List<InventoryFolderBase>>(folderRows.GetLength(0));
475 475
476 foreach (DataRow row in folderRows) 476 foreach (DataRow row in folderRows)
477 { 477 {
478 InventoryFolderBase curFolder = buildFolder(row); 478 InventoryFolderBase curFolder = buildFolder(row);
479 if (curFolder.ParentID != LLUUID.Zero) // Discard root of tree - not needed 479 if (curFolder.ParentID != UUID.Zero) // Discard root of tree - not needed
480 { 480 {
481 if (hashtable.ContainsKey(curFolder.ParentID)) 481 if (hashtable.ContainsKey(curFolder.ParentID))
482 { 482 {
@@ -514,7 +514,7 @@ namespace OpenSim.Data.SQLite
514 /// </summary> 514 /// </summary>
515 /// <param name="item">The UUID of the item to be returned</param> 515 /// <param name="item">The UUID of the item to be returned</param>
516 /// <returns>A class containing item information</returns> 516 /// <returns>A class containing item information</returns>
517 public InventoryItemBase getInventoryItem(LLUUID item) 517 public InventoryItemBase getInventoryItem(UUID item)
518 { 518 {
519 lock (ds) 519 lock (ds)
520 { 520 {
@@ -535,7 +535,7 @@ namespace OpenSim.Data.SQLite
535 /// </summary> 535 /// </summary>
536 /// <param name="folder">The UUID of the folder to be returned</param> 536 /// <param name="folder">The UUID of the folder to be returned</param>
537 /// <returns>A class containing folder information</returns> 537 /// <returns>A class containing folder information</returns>
538 public InventoryFolderBase getInventoryFolder(LLUUID folder) 538 public InventoryFolderBase getInventoryFolder(UUID folder)
539 { 539 {
540 // TODO: Deep voodoo here. If you enable this code then 540 // TODO: Deep voodoo here. If you enable this code then
541 // multi region breaks. No idea why, but I figured it was 541 // multi region breaks. No idea why, but I figured it was
@@ -578,7 +578,7 @@ namespace OpenSim.Data.SQLite
578 /// Delete an inventory item 578 /// Delete an inventory item
579 /// </summary> 579 /// </summary>
580 /// <param name="item">The item UUID</param> 580 /// <param name="item">The item UUID</param>
581 public void deleteInventoryItem(LLUUID itemID) 581 public void deleteInventoryItem(UUID itemID)
582 { 582 {
583 lock (ds) 583 lock (ds)
584 { 584 {
@@ -599,7 +599,7 @@ namespace OpenSim.Data.SQLite
599 /// </summary> 599 /// </summary>
600 /// <param name="folderId">id of the folder, whose item content should be deleted</param> 600 /// <param name="folderId">id of the folder, whose item content should be deleted</param>
601 /// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo> 601 /// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo>
602 private void deleteItemsInFolder(LLUUID folderId) 602 private void deleteItemsInFolder(UUID folderId)
603 { 603 {
604 List<InventoryItemBase> items = getInventoryInFolder(Util.ToRawUuidString(folderId)); 604 List<InventoryItemBase> items = getInventoryInFolder(Util.ToRawUuidString(folderId));
605 605
@@ -641,7 +641,7 @@ namespace OpenSim.Data.SQLite
641 /// This will clean-up any child folders and child items as well 641 /// This will clean-up any child folders and child items as well
642 /// </remarks> 642 /// </remarks>
643 /// <param name="folderID">the folder UUID</param> 643 /// <param name="folderID">the folder UUID</param>
644 public void deleteInventoryFolder(LLUUID folderID) 644 public void deleteInventoryFolder(UUID folderID)
645 { 645 {
646 lock (ds) 646 lock (ds)
647 { 647 {
@@ -791,10 +791,10 @@ namespace OpenSim.Data.SQLite
791 private static InventoryFolderBase buildFolder(DataRow row) 791 private static InventoryFolderBase buildFolder(DataRow row)
792 { 792 {
793 InventoryFolderBase folder = new InventoryFolderBase(); 793 InventoryFolderBase folder = new InventoryFolderBase();
794 folder.ID = new LLUUID((string) row["UUID"]); 794 folder.ID = new UUID((string) row["UUID"]);
795 folder.Name = (string) row["name"]; 795 folder.Name = (string) row["name"];
796 folder.Owner = new LLUUID((string) row["agentID"]); 796 folder.Owner = new UUID((string) row["agentID"]);
797 folder.ParentID = new LLUUID((string) row["parentID"]); 797 folder.ParentID = new UUID((string) row["parentID"]);
798 folder.Type = Convert.ToInt16(row["type"]); 798 folder.Type = Convert.ToInt16(row["type"]);
799 folder.Version = Convert.ToUInt16(row["version"]); 799 folder.Version = Convert.ToUInt16(row["version"]);
800 return folder; 800 return folder;