aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2007-12-20 18:43:39 +0000
committerJustin Clarke Casey2007-12-20 18:43:39 +0000
commitdd1e2c8eb9de34c2464bd526a782b47ec1c823e5 (patch)
tree350a9419f82c8212ed733145cae95a1c4a66d4eb /OpenSim
parent*Ban lines now work if they are enabled grid wide. (diff)
downloadopensim-SC_OLD-dd1e2c8eb9de34c2464bd526a782b47ec1c823e5.zip
opensim-SC_OLD-dd1e2c8eb9de34c2464bd526a782b47ec1c823e5.tar.gz
opensim-SC_OLD-dd1e2c8eb9de34c2464bd526a782b47ec1c823e5.tar.bz2
opensim-SC_OLD-dd1e2c8eb9de34c2464bd526a782b47ec1c823e5.tar.xz
Establish Util.ToRawUuidString to get LLUUIDs in unhyphenated form
Apply method to UUID crud in SqliteInventoryStore as an initial test This appears now to successfully recover inventory upon login This will almost certainly only work on standalone
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs48
-rw-r--r--OpenSim/Framework/Util.cs10
2 files changed, 34 insertions, 24 deletions
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index fe27e32..ac6c877 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -106,13 +106,13 @@ namespace OpenSim.Framework.Data.SQLite
106 106
107 private void fillItemRow(DataRow row, InventoryItemBase item) 107 private void fillItemRow(DataRow row, InventoryItemBase item)
108 { 108 {
109 row["UUID"] = item.inventoryID; 109 row["UUID"] = Util.ToRawUuidString(item.inventoryID);
110 row["assetID"] = item.assetID; 110 row["assetID"] = Util.ToRawUuidString(item.assetID);
111 row["assetType"] = item.assetType; 111 row["assetType"] = item.assetType;
112 row["invType"] = item.invType; 112 row["invType"] = item.invType;
113 row["parentFolderID"] = item.parentFolderID; 113 row["parentFolderID"] = Util.ToRawUuidString(item.parentFolderID);
114 row["avatarID"] = item.avatarID; 114 row["avatarID"] = Util.ToRawUuidString(item.avatarID);
115 row["creatorsID"] = item.creatorsID; 115 row["creatorsID"] = Util.ToRawUuidString(item.creatorsID);
116 row["inventoryName"] = item.inventoryName; 116 row["inventoryName"] = item.inventoryName;
117 row["inventoryDescription"] = item.inventoryDescription; 117 row["inventoryDescription"] = item.inventoryDescription;
118 118
@@ -126,7 +126,7 @@ namespace OpenSim.Framework.Data.SQLite
126 { 126 {
127 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 127 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
128 128
129 DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.folderID); 129 DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.folderID));
130 if (inventoryRow == null) 130 if (inventoryRow == null)
131 { 131 {
132 inventoryRow = inventoryFolderTable.NewRow(); 132 inventoryRow = inventoryFolderTable.NewRow();
@@ -145,7 +145,7 @@ namespace OpenSim.Framework.Data.SQLite
145 { 145 {
146 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 146 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
147 147
148 DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.folderID); 148 DataRow inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folder.folderID));
149 if (inventoryRow == null) 149 if (inventoryRow == null)
150 { 150 {
151 inventoryRow = inventoryFolderTable.NewRow(); 151 inventoryRow = inventoryFolderTable.NewRow();
@@ -163,7 +163,7 @@ namespace OpenSim.Framework.Data.SQLite
163 { 163 {
164 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 164 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
165 165
166 DataRow inventoryRow = inventoryItemTable.Rows.Find(item.inventoryID); 166 DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(item.inventoryID));
167 if (inventoryRow == null) 167 if (inventoryRow == null)
168 { 168 {
169 inventoryRow = inventoryItemTable.NewRow(); 169 inventoryRow = inventoryItemTable.NewRow();
@@ -223,7 +223,7 @@ namespace OpenSim.Framework.Data.SQLite
223 { 223 {
224 List<InventoryItemBase> retval = new List<InventoryItemBase>(); 224 List<InventoryItemBase> retval = new List<InventoryItemBase>();
225 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 225 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
226 string selectExp = "parentFolderID = '" + folderID.ToString() + "'"; 226 string selectExp = "parentFolderID = '" + Util.ToRawUuidString(folderID) + "'";
227 DataRow[] rows = inventoryItemTable.Select(selectExp); 227 DataRow[] rows = inventoryItemTable.Select(selectExp);
228 foreach (DataRow row in rows) 228 foreach (DataRow row in rows)
229 { 229 {
@@ -248,7 +248,7 @@ namespace OpenSim.Framework.Data.SQLite
248 { 248 {
249 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 249 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
250 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 250 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
251 string selectExp = "agentID = '" + user.ToString() + "' AND parentID = '" + LLUUID.Zero.ToString() + "'"; 251 string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" + Util.ToRawUuidString(LLUUID.Zero) + "'";
252 DataRow[] rows = inventoryFolderTable.Select(selectExp); 252 DataRow[] rows = inventoryFolderTable.Select(selectExp);
253 foreach (DataRow row in rows) 253 foreach (DataRow row in rows)
254 { 254 {
@@ -276,7 +276,7 @@ namespace OpenSim.Framework.Data.SQLite
276 protected void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID) 276 protected void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID)
277 { 277 {
278 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 278 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
279 string selectExp = "parentID = '" + parentID.ToString() + "'"; 279 string selectExp = "parentID = '" + Util.ToRawUuidString(parentID) + "'";
280 DataRow[] rows = inventoryFolderTable.Select(selectExp); 280 DataRow[] rows = inventoryFolderTable.Select(selectExp);
281 foreach (DataRow row in rows) 281 foreach (DataRow row in rows)
282 { 282 {
@@ -292,7 +292,7 @@ namespace OpenSim.Framework.Data.SQLite
292 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) 292 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
293 { 293 {
294 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 294 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
295 getInventoryFolders(ref folders, parentID); 295 getInventoryFolders(ref folders, Util.ToRawUuidString(parentID));
296 return folders; 296 return folders;
297 } 297 }
298 298
@@ -304,10 +304,10 @@ namespace OpenSim.Framework.Data.SQLite
304 protected List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID) 304 protected List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID)
305 { 305 {
306 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 306 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
307 getInventoryFolders(ref folders, parentID); 307 getInventoryFolders(ref folders, Util.ToRawUuidString(parentID));
308 308
309 for (int i = 0; i < folders.Count; i++) 309 for (int i = 0; i < folders.Count; i++)
310 getInventoryFolders(ref folders, folders[i].folderID); 310 getInventoryFolders(ref folders, Util.ToRawUuidString(folders[i].folderID));
311 311
312 return folders; 312 return folders;
313 } 313 }
@@ -319,7 +319,7 @@ namespace OpenSim.Framework.Data.SQLite
319 /// <returns>A class containing item information</returns> 319 /// <returns>A class containing item information</returns>
320 public InventoryItemBase getInventoryItem(LLUUID item) 320 public InventoryItemBase getInventoryItem(LLUUID item)
321 { 321 {
322 DataRow row = ds.Tables["inventoryitems"].Rows.Find(item); 322 DataRow row = ds.Tables["inventoryitems"].Rows.Find(Util.ToRawUuidString(item));
323 if (row != null) 323 if (row != null)
324 { 324 {
325 return buildItem(row); 325 return buildItem(row);
@@ -343,7 +343,7 @@ namespace OpenSim.Framework.Data.SQLite
343 // that you don't get to see system textures why creating 343 // that you don't get to see system textures why creating
344 // clothes and the like. :( 344 // clothes and the like. :(
345 345
346 DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder); 346 DataRow row = ds.Tables["inventoryfolders"].Rows.Find(Util.ToRawUuidString(folder));
347 if (row != null) 347 if (row != null)
348 { 348 {
349 return buildFolder(row); 349 return buildFolder(row);
@@ -380,7 +380,7 @@ namespace OpenSim.Framework.Data.SQLite
380 { 380 {
381 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 381 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
382 382
383 DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID); 383 DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(itemID));
384 if (inventoryRow != null) 384 if (inventoryRow != null)
385 { 385 {
386 inventoryRow.Delete(); 386 inventoryRow.Delete();
@@ -397,10 +397,10 @@ namespace OpenSim.Framework.Data.SQLite
397 //!TODO, this is horribly inefficient, but I don't want to ruin the overall structure of this implementation 397 //!TODO, this is horribly inefficient, but I don't want to ruin the overall structure of this implementation
398 private void deleteItemsInFolder(LLUUID folderId) 398 private void deleteItemsInFolder(LLUUID folderId)
399 { 399 {
400 List<InventoryItemBase> items = getInventoryInFolder(folderId); 400 List<InventoryItemBase> items = getInventoryInFolder(Util.ToRawUuidString(folderId));
401 401
402 foreach (InventoryItemBase i in items) 402 foreach (InventoryItemBase i in items)
403 deleteInventoryItem(i.inventoryID); 403 deleteInventoryItem(Util.ToRawUuidString(i.inventoryID));
404 } 404 }
405 405
406 /// <summary> 406 /// <summary>
@@ -439,7 +439,7 @@ namespace OpenSim.Framework.Data.SQLite
439 /// <param name="item"></param> 439 /// <param name="item"></param>
440 public void deleteInventoryFolder(LLUUID folderID) 440 public void deleteInventoryFolder(LLUUID folderID)
441 { 441 {
442 List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID); 442 List<InventoryFolderBase> subFolders = getFolderHierarchy(Util.ToRawUuidString(folderID));
443 443
444 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 444 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
445 DataRow inventoryRow; 445 DataRow inventoryRow;
@@ -447,19 +447,19 @@ namespace OpenSim.Framework.Data.SQLite
447 //Delete all sub-folders 447 //Delete all sub-folders
448 foreach (InventoryFolderBase f in subFolders) 448 foreach (InventoryFolderBase f in subFolders)
449 { 449 {
450 inventoryRow = inventoryFolderTable.Rows.Find(f.folderID); 450 inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(f.folderID));
451 if (inventoryRow != null) 451 if (inventoryRow != null)
452 { 452 {
453 deleteItemsInFolder(f.folderID); 453 deleteItemsInFolder(Util.ToRawUuidString(f.folderID));
454 inventoryRow.Delete(); 454 inventoryRow.Delete();
455 } 455 }
456 } 456 }
457 457
458 //Delete the actual row 458 //Delete the actual row
459 inventoryRow = inventoryFolderTable.Rows.Find(folderID); 459 inventoryRow = inventoryFolderTable.Rows.Find(Util.ToRawUuidString(folderID));
460 if (inventoryRow != null) 460 if (inventoryRow != null)
461 { 461 {
462 deleteItemsInFolder(folderID); 462 deleteItemsInFolder(Util.ToRawUuidString(folderID));
463 inventoryRow.Delete(); 463 inventoryRow.Delete();
464 } 464 }
465 465
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index db841cf..0b05eac 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -383,5 +383,15 @@ namespace OpenSim.Framework
383 { 383 {
384 return Math.Min(Math.Max(x, min), max); 384 return Math.Min(Math.Max(x, min), max);
385 } 385 }
386
387 /// <summary>
388 /// Convert an LLUUID to a raw uuid string. This is a string without hyphens.
389 /// </summary>
390 /// <param name="lluuid"></param>
391 /// <returns></returns>
392 public static String ToRawUuidString(LLUUID lluuid)
393 {
394 return lluuid.UUID.ToString("n");
395 }
386 } 396 }
387} 397}