aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/SQLite/Resources/004_InventoryStore.sql15
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs55
2 files changed, 42 insertions, 28 deletions
diff --git a/OpenSim/Data/SQLite/Resources/004_InventoryStore.sql b/OpenSim/Data/SQLite/Resources/004_InventoryStore.sql
new file mode 100644
index 0000000..5985d80
--- /dev/null
+++ b/OpenSim/Data/SQLite/Resources/004_InventoryStore.sql
@@ -0,0 +1,15 @@
1BEGIN;
2
3update inventoryitems
4 set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21),
5 assetID = substr(assetID, 1, 8) || "-" || substr(assetID, 9, 4) || "-" || substr(assetID, 13, 4) || "-" || substr(assetID, 17, 4) || "-" || substr(assetID, 21),
6 parentFolderID = substr(parentFolderID, 1, 8) || "-" || substr(parentFolderID, 9, 4) || "-" || substr(parentFolderID, 13, 4) || "-" || substr(parentFolderID, 17, 4) || "-" || substr(parentFolderID, 21),
7 avatarID = substr(avatarID, 1, 8) || "-" || substr(avatarID, 9, 4) || "-" || substr(avatarID, 13, 4) || "-" || substr(avatarID, 17, 4) || "-" || substr(avatarID, 21),
8 creatorsID = substr(creatorsID, 1, 8) || "-" || substr(creatorsID, 9, 4) || "-" || substr(creatorsID, 13, 4) || "-" || substr(creatorsID, 17, 4) || "-" || substr(creatorsID, 21);
9
10update inventoryfolders
11 set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21),
12 agentID = substr(agentID, 1, 8) || "-" || substr(agentID, 9, 4) || "-" || substr(agentID, 13, 4) || "-" || substr(agentID, 17, 4) || "-" || substr(agentID, 21),
13 parentID = substr(parentID, 1, 8) || "-" || substr(parentID, 9, 4) || "-" || substr(parentID, 13, 4) || "-" || substr(parentID, 17, 4) || "-" || substr(parentID, 21);
14
15COMMIT;
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index aedcd82..e84eed5 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Data.SQLite
54 public void Initialise() 54 public void Initialise()
55 { 55 {
56 m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!"); 56 m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!");
57 throw new PluginNotInitialisedException (Name); 57 throw new PluginNotInitialisedException(Name);
58 } 58 }
59 59
60 /// <summary> 60 /// <summary>
@@ -182,13 +182,13 @@ namespace OpenSim.Data.SQLite
182 /// <param name="item"></param> 182 /// <param name="item"></param>
183 private static void fillItemRow(DataRow row, InventoryItemBase item) 183 private static void fillItemRow(DataRow row, InventoryItemBase item)
184 { 184 {
185 row["UUID"] = Util.ToRawUuidString(item.ID); 185 row["UUID"] = item.ID.ToString();
186 row["assetID"] = Util.ToRawUuidString(item.AssetID); 186 row["assetID"] = item.AssetID.ToString();
187 row["assetType"] = item.AssetType; 187 row["assetType"] = item.AssetType;
188 row["invType"] = item.InvType; 188 row["invType"] = item.InvType;
189 row["parentFolderID"] = Util.ToRawUuidString(item.Folder); 189 row["parentFolderID"] = item.Folder.ToString();
190 row["avatarID"] = Util.ToRawUuidString(item.Owner); 190 row["avatarID"] = item.Owner.ToString();
191 row["creatorsID"] = Util.ToRawUuidString(item.CreatorIdAsUuid); 191 row["creatorsID"] = item.CreatorId;
192 row["inventoryName"] = item.Name; 192 row["inventoryName"] = item.Name;
193 row["inventoryDescription"] = item.Description; 193 row["inventoryDescription"] = item.Description;
194 194
@@ -219,7 +219,7 @@ namespace OpenSim.Data.SQLite
219 { 219 {
220 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 220 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
221 221
222 DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.ID)); 222 DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
223 if (inventoryRow == null) 223 if (inventoryRow == null)
224 { 224 {
225 if (! add) 225 if (! add)
@@ -251,7 +251,7 @@ namespace OpenSim.Data.SQLite
251 { 251 {
252 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 252 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
253 253
254 DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.ID)); 254 DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
255 if (inventoryRow == null) 255 if (inventoryRow == null)
256 { 256 {
257 inventoryRow = inventoryFolderTable.NewRow(); 257 inventoryRow = inventoryFolderTable.NewRow();
@@ -278,7 +278,7 @@ namespace OpenSim.Data.SQLite
278 { 278 {
279 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 279 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
280 280
281 DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(item.ID)); 281 DataRow inventoryRow = inventoryItemTable.Rows.Find(item.ID.ToString());
282 if (inventoryRow == null) 282 if (inventoryRow == null)
283 { 283 {
284 if (!add) 284 if (!add)
@@ -300,7 +300,7 @@ namespace OpenSim.Data.SQLite
300 300
301 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 301 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
302 302
303 inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(item.Folder)); 303 inventoryRow = inventoryFolderTable.Rows.Find(item.Folder.ToString());
304 inventoryRow["version"] = (int)inventoryRow["version"] + 1; 304 inventoryRow["version"] = (int)inventoryRow["version"] + 1;
305 305
306 invFoldersDa.Update(ds, "inventoryfolders"); 306 invFoldersDa.Update(ds, "inventoryfolders");
@@ -354,7 +354,7 @@ namespace OpenSim.Data.SQLite
354 { 354 {
355 List<InventoryItemBase> retval = new List<InventoryItemBase>(); 355 List<InventoryItemBase> retval = new List<InventoryItemBase>();
356 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 356 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
357 string selectExp = "parentFolderID = '" + Util.ToRawUuidString(folderID) + "'"; 357 string selectExp = "parentFolderID = '" + folderID + "'";
358 DataRow[] rows = inventoryItemTable.Select(selectExp); 358 DataRow[] rows = inventoryItemTable.Select(selectExp);
359 foreach (DataRow row in rows) 359 foreach (DataRow row in rows)
360 { 360 {
@@ -382,8 +382,7 @@ namespace OpenSim.Data.SQLite
382 { 382 {
383 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 383 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
384 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 384 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
385 string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" + 385 string selectExp = "agentID = '" + user + "' AND parentID = '" + UUID.Zero + "'";
386 Util.ToRawUuidString(UUID.Zero) + "'";
387 DataRow[] rows = inventoryFolderTable.Select(selectExp); 386 DataRow[] rows = inventoryFolderTable.Select(selectExp);
388 foreach (DataRow row in rows) 387 foreach (DataRow row in rows)
389 { 388 {
@@ -414,7 +413,7 @@ namespace OpenSim.Data.SQLite
414 lock (ds) 413 lock (ds)
415 { 414 {
416 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 415 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
417 string selectExp = "parentID = '" + Util.ToRawUuidString(parentID) + "'"; 416 string selectExp = "parentID = '" + parentID + "'";
418 DataRow[] rows = inventoryFolderTable.Select(selectExp); 417 DataRow[] rows = inventoryFolderTable.Select(selectExp);
419 foreach (DataRow row in rows) 418 foreach (DataRow row in rows)
420 { 419 {
@@ -467,13 +466,13 @@ namespace OpenSim.Data.SQLite
467 * Then fetch all inventory folders for that agent from the agent ID. 466 * Then fetch all inventory folders for that agent from the agent ID.
468 */ 467 */
469 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 468 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
470 string selectExp = "UUID = '" + Util.ToRawUuidString(parentID) + "'"; 469 string selectExp = "UUID = '" + parentID + "'";
471 parentRow = inventoryFolderTable.Select(selectExp); // Assume at most 1 result 470 parentRow = inventoryFolderTable.Select(selectExp); // Assume at most 1 result
472 if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist 471 if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist
473 { 472 {
474 parentFolder = buildFolder(parentRow[0]); 473 parentFolder = buildFolder(parentRow[0]);
475 UUID agentID = parentFolder.Owner; 474 UUID agentID = parentFolder.Owner;
476 selectExp = "agentID = '" + Util.ToRawUuidString(agentID) + "'"; 475 selectExp = "agentID = '" + agentID + "'";
477 folderRows = inventoryFolderTable.Select(selectExp); 476 folderRows = inventoryFolderTable.Select(selectExp);
478 } 477 }
479 478
@@ -550,7 +549,7 @@ namespace OpenSim.Data.SQLite
550 { 549 {
551 lock (ds) 550 lock (ds)
552 { 551 {
553 DataRow row = ds.Tables["inventoryitems"].Rows.Find(Util.ToRawUuidString(item)); 552 DataRow row = ds.Tables["inventoryitems"].Rows.Find(item.ToString());
554 if (row != null) 553 if (row != null)
555 { 554 {
556 return buildItem(row); 555 return buildItem(row);
@@ -576,7 +575,7 @@ namespace OpenSim.Data.SQLite
576 // clothes and the like. :( 575 // clothes and the like. :(
577 lock (ds) 576 lock (ds)
578 { 577 {
579 DataRow row = ds.Tables["inventoryfolders"].Rows.Find(Util.ToRawUuidString(folder)); 578 DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder.ToString());
580 if (row != null) 579 if (row != null)
581 { 580 {
582 return buildFolder(row); 581 return buildFolder(row);
@@ -616,7 +615,7 @@ namespace OpenSim.Data.SQLite
616 { 615 {
617 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 616 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
618 617
619 DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(itemID)); 618 DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID.ToString());
620 if (inventoryRow != null) 619 if (inventoryRow != null)
621 { 620 {
622 inventoryRow.Delete(); 621 inventoryRow.Delete();
@@ -695,7 +694,7 @@ namespace OpenSim.Data.SQLite
695 //Delete all sub-folders 694 //Delete all sub-folders
696 foreach (InventoryFolderBase f in subFolders) 695 foreach (InventoryFolderBase f in subFolders)
697 { 696 {
698 inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(f.ID)); 697 inventoryRow = inventoryFolderTable.Rows.Find(f.ID.ToString());
699 if (inventoryRow != null) 698 if (inventoryRow != null)
700 { 699 {
701 deleteItemsInFolder(f.ID); 700 deleteItemsInFolder(f.ID);
@@ -704,7 +703,7 @@ namespace OpenSim.Data.SQLite
704 } 703 }
705 704
706 //Delete the actual row 705 //Delete the actual row
707 inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folderID)); 706 inventoryRow = inventoryFolderTable.Rows.Find(folderID.ToString());
708 if (inventoryRow != null) 707 if (inventoryRow != null)
709 { 708 {
710 deleteItemsInFolder(folderID); 709 deleteItemsInFolder(folderID);
@@ -850,10 +849,10 @@ namespace OpenSim.Data.SQLite
850 /// <param name="folder"></param> 849 /// <param name="folder"></param>
851 private static void fillFolderRow(DataRow row, InventoryFolderBase folder) 850 private static void fillFolderRow(DataRow row, InventoryFolderBase folder)
852 { 851 {
853 row["UUID"] = Util.ToRawUuidString(folder.ID); 852 row["UUID"] = folder.ID.ToString();
854 row["name"] = folder.Name; 853 row["name"] = folder.Name;
855 row["agentID"] = Util.ToRawUuidString(folder.Owner); 854 row["agentID"] = folder.Owner.ToString();
856 row["parentID"] = Util.ToRawUuidString(folder.ParentID); 855 row["parentID"] = folder.ParentID.ToString();
857 row["type"] = folder.Type; 856 row["type"] = folder.Type;
858 row["version"] = folder.Version; 857 row["version"] = folder.Version;
859 } 858 }
@@ -865,8 +864,8 @@ namespace OpenSim.Data.SQLite
865 /// <param name="folder"></param> 864 /// <param name="folder"></param>
866 private static void moveFolderRow(DataRow row, InventoryFolderBase folder) 865 private static void moveFolderRow(DataRow row, InventoryFolderBase folder)
867 { 866 {
868 row["UUID"] = Util.ToRawUuidString(folder.ID); 867 row["UUID"] = folder.ID.ToString();
869 row["parentID"] = Util.ToRawUuidString(folder.ParentID); 868 row["parentID"] = folder.ParentID.ToString();
870 } 869 }
871 870
872 public List<InventoryItemBase> fetchActiveGestures (UUID avatarID) 871 public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
@@ -876,8 +875,8 @@ namespace OpenSim.Data.SQLite
876 List<InventoryItemBase> items = new List<InventoryItemBase>(); 875 List<InventoryItemBase> items = new List<InventoryItemBase>();
877 876
878 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 877 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
879 string selectExp = "avatarID = '" + Util.ToRawUuidString(avatarID) + "' AND assetType = " + 878 string selectExp
880 (int)AssetType.Gesture + " AND flags = 1"; 879 = "avatarID = '" + avatarID + "' AND assetType = " + (int)AssetType.Gesture + " AND flags = 1";
881 m_log.DebugFormat("[SQL]: sql = " + selectExp); 880 m_log.DebugFormat("[SQL]: sql = " + selectExp);
882 DataRow[] rows = inventoryItemTable.Select(selectExp); 881 DataRow[] rows = inventoryItemTable.Select(selectExp);
883 foreach (DataRow row in rows) 882 foreach (DataRow row in rows)