diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index e29b99c..125b6e7 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs | |||
@@ -50,8 +50,8 @@ namespace OpenSim.Data.SQLite | |||
50 | private SqliteDataAdapter invItemsDa; | 50 | private SqliteDataAdapter invItemsDa; |
51 | private SqliteDataAdapter invFoldersDa; | 51 | private SqliteDataAdapter invFoldersDa; |
52 | 52 | ||
53 | public void Initialise() | 53 | public void Initialise() |
54 | { | 54 | { |
55 | m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!"); | 55 | m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!"); |
56 | throw new PluginNotInitialisedException (Name); | 56 | throw new PluginNotInitialisedException (Name); |
57 | } | 57 | } |
@@ -105,7 +105,7 @@ namespace OpenSim.Data.SQLite | |||
105 | } | 105 | } |
106 | 106 | ||
107 | /// <summary> | 107 | /// <summary> |
108 | /// | 108 | /// |
109 | /// </summary> | 109 | /// </summary> |
110 | /// <param name="row"></param> | 110 | /// <param name="row"></param> |
111 | /// <returns></returns> | 111 | /// <returns></returns> |
@@ -150,7 +150,7 @@ namespace OpenSim.Data.SQLite | |||
150 | } | 150 | } |
151 | 151 | ||
152 | /// <summary> | 152 | /// <summary> |
153 | /// | 153 | /// |
154 | /// </summary> | 154 | /// </summary> |
155 | /// <param name="row"></param> | 155 | /// <param name="row"></param> |
156 | /// <param name="item"></param> | 156 | /// <param name="item"></param> |
@@ -302,7 +302,7 @@ namespace OpenSim.Data.SQLite | |||
302 | /// <returns>A string containing the DB provider version</returns> | 302 | /// <returns>A string containing the DB provider version</returns> |
303 | public string Version | 303 | public string Version |
304 | { | 304 | { |
305 | get | 305 | get |
306 | { | 306 | { |
307 | Module module = GetType().Module; | 307 | Module module = GetType().Module; |
308 | // string dllName = module.Assembly.ManifestModule.Name; | 308 | // string dllName = module.Assembly.ManifestModule.Name; |
@@ -419,10 +419,10 @@ namespace OpenSim.Data.SQLite | |||
419 | * - We will only need to hit the database twice instead of n times. | 419 | * - We will only need to hit the database twice instead of n times. |
420 | * - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned | 420 | * - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned |
421 | * by the same person, each user only has 1 inventory heirarchy | 421 | * by the same person, each user only has 1 inventory heirarchy |
422 | * - The returned list is not ordered, instead of breadth-first ordered | 422 | * - The returned list is not ordered, instead of breadth-first ordered |
423 | There are basically 2 usage cases for getFolderHeirarchy: | 423 | There are basically 2 usage cases for getFolderHeirarchy: |
424 | 1) Getting the user's entire inventory heirarchy when they log in | 424 | 1) Getting the user's entire inventory heirarchy when they log in |
425 | 2) Finding a subfolder heirarchy to delete when emptying the trash. | 425 | 2) Finding a subfolder heirarchy to delete when emptying the trash. |
426 | This implementation will pull all inventory folders from the database, and then prune away any folder that | 426 | This implementation will pull all inventory folders from the database, and then prune away any folder that |
427 | is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the | 427 | is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the |
428 | database than to make n requests. This pays off only if requested heirarchy is large. | 428 | database than to make n requests. This pays off only if requested heirarchy is large. |
@@ -449,17 +449,17 @@ namespace OpenSim.Data.SQLite | |||
449 | folderRows = inventoryFolderTable.Select(selectExp); | 449 | folderRows = inventoryFolderTable.Select(selectExp); |
450 | } | 450 | } |
451 | 451 | ||
452 | if ( folderRows!=null && folderRows.GetLength(0)>=1 ) // No result means parent folder does not exist | 452 | if (folderRows != null && folderRows.GetLength(0) >= 1) // No result means parent folder does not exist |
453 | { // or has no children | 453 | { // or has no children |
454 | /* if we're querying the root folder, just return an unordered list of all folders in the user's | 454 | /* if we're querying the root folder, just return an unordered list of all folders in the user's |
455 | * inventory | 455 | * inventory |
456 | */ | 456 | */ |
457 | if (parentFolder.ParentID == LLUUID.Zero) | 457 | if (parentFolder.ParentID == LLUUID.Zero) |
458 | { | 458 | { |
459 | foreach (DataRow row in folderRows) | 459 | foreach (DataRow row in folderRows) |
460 | { | 460 | { |
461 | InventoryFolderBase curFolder = buildFolder(row); | 461 | InventoryFolderBase curFolder = buildFolder(row); |
462 | if (curFolder.ID != parentID) // Return all folders except the parent folder of heirarchy | 462 | if (curFolder.ID != parentID) // Return all folders except the parent folder of heirarchy |
463 | folders.Add(buildFolder(row)); | 463 | folders.Add(buildFolder(row)); |
464 | } | 464 | } |
465 | } // If requesting root folder | 465 | } // If requesting root folder |
@@ -481,16 +481,16 @@ namespace OpenSim.Data.SQLite | |||
481 | InventoryFolderBase curFolder = buildFolder(row); | 481 | InventoryFolderBase curFolder = buildFolder(row); |
482 | if (curFolder.ParentID != LLUUID.Zero) // Discard root of tree - not needed | 482 | if (curFolder.ParentID != LLUUID.Zero) // Discard root of tree - not needed |
483 | { | 483 | { |
484 | if ( hashtable.ContainsKey(curFolder.ParentID ) ) | 484 | if (hashtable.ContainsKey(curFolder.ParentID)) |
485 | { | 485 | { |
486 | // Current folder already has a sibling - append to sibling list | 486 | // Current folder already has a sibling - append to sibling list |
487 | hashtable[curFolder.ParentID].Add( curFolder ); | 487 | hashtable[curFolder.ParentID].Add(curFolder); |
488 | } | 488 | } |
489 | else { | 489 | else { |
490 | List<InventoryFolderBase> siblingList = new List<InventoryFolderBase>(); | 490 | List<InventoryFolderBase> siblingList = new List<InventoryFolderBase>(); |
491 | siblingList.Add( curFolder ); | 491 | siblingList.Add(curFolder); |
492 | // Current folder has no known (yet) siblings | 492 | // Current folder has no known (yet) siblings |
493 | hashtable.Add( curFolder.ParentID, siblingList ); | 493 | hashtable.Add(curFolder.ParentID, siblingList); |
494 | } | 494 | } |
495 | } | 495 | } |
496 | } // For all inventory folders | 496 | } // For all inventory folders |
@@ -498,12 +498,12 @@ namespace OpenSim.Data.SQLite | |||
498 | // Note: Could release the ds lock here - we don't access folderRows or the database anymore. | 498 | // Note: Could release the ds lock here - we don't access folderRows or the database anymore. |
499 | // This is somewhat of a moot point as the callers of this function usually lock db anyways. | 499 | // This is somewhat of a moot point as the callers of this function usually lock db anyways. |
500 | 500 | ||
501 | if ( hashtable.ContainsKey( parentID ) ) // if requested folder does have children | 501 | if (hashtable.ContainsKey(parentID)) // if requested folder does have children |
502 | folders.AddRange( hashtable[parentID] ); | 502 | folders.AddRange(hashtable[parentID]); |
503 | 503 | ||
504 | // BreadthFirstSearch build inventory tree **Note: folders.Count is *not* static | 504 | // BreadthFirstSearch build inventory tree **Note: folders.Count is *not* static |
505 | for ( int i = 0; i < folders.Count; i++ ) | 505 | for (int i = 0; i < folders.Count; i++) |
506 | if (hashtable.ContainsKey(folders[i].ID)) | 506 | if (hashtable.ContainsKey(folders[i].ID)) |
507 | folders.AddRange(hashtable[folders[i].ID]); | 507 | folders.AddRange(hashtable[folders[i].ID]); |
508 | 508 | ||
509 | } // if requesting a subfolder heirarchy | 509 | } // if requesting a subfolder heirarchy |
@@ -601,7 +601,7 @@ namespace OpenSim.Data.SQLite | |||
601 | /// Delete all items in the specified folder | 601 | /// Delete all items in the specified folder |
602 | /// </summary> | 602 | /// </summary> |
603 | /// <param name="folderId">id of the folder, whose item content should be deleted</param> | 603 | /// <param name="folderId">id of the folder, whose item content should be deleted</param> |
604 | /// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo> | 604 | /// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo> |
605 | private void deleteItemsInFolder(LLUUID folderId) | 605 | private void deleteItemsInFolder(LLUUID folderId) |
606 | { | 606 | { |
607 | List<InventoryItemBase> items = getInventoryInFolder(Util.ToRawUuidString(folderId)); | 607 | List<InventoryItemBase> items = getInventoryInFolder(Util.ToRawUuidString(folderId)); |
@@ -743,7 +743,7 @@ namespace OpenSim.Data.SQLite | |||
743 | } | 743 | } |
744 | 744 | ||
745 | /// <summary> | 745 | /// <summary> |
746 | /// | 746 | /// |
747 | /// </summary> | 747 | /// </summary> |
748 | /// <param name="da"></param> | 748 | /// <param name="da"></param> |
749 | /// <param name="conn"></param> | 749 | /// <param name="conn"></param> |
@@ -765,7 +765,7 @@ namespace OpenSim.Data.SQLite | |||
765 | } | 765 | } |
766 | 766 | ||
767 | /// <summary> | 767 | /// <summary> |
768 | /// | 768 | /// |
769 | /// </summary> | 769 | /// </summary> |
770 | /// <param name="da"></param> | 770 | /// <param name="da"></param> |
771 | /// <param name="conn"></param> | 771 | /// <param name="conn"></param> |
@@ -787,7 +787,7 @@ namespace OpenSim.Data.SQLite | |||
787 | } | 787 | } |
788 | 788 | ||
789 | /// <summary> | 789 | /// <summary> |
790 | /// | 790 | /// |
791 | /// </summary> | 791 | /// </summary> |
792 | /// <param name="row"></param> | 792 | /// <param name="row"></param> |
793 | /// <returns></returns> | 793 | /// <returns></returns> |
@@ -804,7 +804,7 @@ namespace OpenSim.Data.SQLite | |||
804 | } | 804 | } |
805 | 805 | ||
806 | /// <summary> | 806 | /// <summary> |
807 | /// | 807 | /// |
808 | /// </summary> | 808 | /// </summary> |
809 | /// <param name="row"></param> | 809 | /// <param name="row"></param> |
810 | /// <param name="folder"></param> | 810 | /// <param name="folder"></param> |
@@ -819,7 +819,7 @@ namespace OpenSim.Data.SQLite | |||
819 | } | 819 | } |
820 | 820 | ||
821 | /// <summary> | 821 | /// <summary> |
822 | /// | 822 | /// |
823 | /// </summary> | 823 | /// </summary> |
824 | /// <param name="row"></param> | 824 | /// <param name="row"></param> |
825 | /// <param name="folder"></param> | 825 | /// <param name="folder"></param> |
@@ -836,7 +836,7 @@ namespace OpenSim.Data.SQLite | |||
836 | **********************************************************************/ | 836 | **********************************************************************/ |
837 | 837 | ||
838 | /// <summary> | 838 | /// <summary> |
839 | /// | 839 | /// |
840 | /// </summary> | 840 | /// </summary> |
841 | /// <param name="conn"></param> | 841 | /// <param name="conn"></param> |
842 | // private static void InitDB(SqliteConnection conn) | 842 | // private static void InitDB(SqliteConnection conn) |
@@ -852,7 +852,7 @@ namespace OpenSim.Data.SQLite | |||
852 | // } | 852 | // } |
853 | 853 | ||
854 | /// <summary> | 854 | /// <summary> |
855 | /// | 855 | /// |
856 | /// </summary> | 856 | /// </summary> |
857 | /// <param name="conn"></param> | 857 | /// <param name="conn"></param> |
858 | /// <param name="m"></param> | 858 | /// <param name="m"></param> |