aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLInventoryData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLInventoryData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs33
1 files changed, 13 insertions, 20 deletions
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index e0e9b9c..0aea30f 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -32,6 +32,7 @@ using log4net;
32using MySql.Data.MySqlClient; 32using MySql.Data.MySqlClient;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Data;
35 36
36namespace OpenSim.Data.MySQL 37namespace OpenSim.Data.MySQL
37{ 38{
@@ -285,31 +286,23 @@ namespace OpenSim.Data.MySQL
285 InventoryItemBase item = new InventoryItemBase(); 286 InventoryItemBase item = new InventoryItemBase();
286 287
287 // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. 288 // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these.
288 if (reader["creatorID"] == null) 289 // ( DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero )
289 { 290 item.CreatorId = reader["creatorID"].ToString();
290 item.CreatorId = UUID.Zero.ToString();
291 }
292 else
293 {
294 item.CreatorId = (string)reader["creatorID"];
295 }
296 291
297 // Be a bit safer in parsing these because the 292 // Be a bit safer in parsing these because the
298 // database doesn't enforce them to be not null, and 293 // database doesn't enforce them to be not null, and
299 // the inventory still works if these are weird in the 294 // the inventory still works if these are weird in the
300 // db 295 // db
301 UUID Owner = UUID.Zero; 296
302 UUID GroupID = UUID.Zero; 297 // (Empty is Ok, but "weird" will throw!)
303 UUID.TryParse((string)reader["avatarID"], out Owner); 298 item.Owner = DBGuid.FromDB(reader["avatarID"]);
304 UUID.TryParse((string)reader["groupID"], out GroupID); 299 item.GroupID = DBGuid.FromDB(reader["groupID"]);
305 item.Owner = Owner;
306 item.GroupID = GroupID;
307 300
308 // Rest of the parsing. If these UUID's fail, we're dead anyway 301 // Rest of the parsing. If these UUID's fail, we're dead anyway
309 item.ID = new UUID((string) reader["inventoryID"]); 302 item.ID = DBGuid.FromDB(reader["inventoryID"]);
310 item.AssetID = new UUID((string) reader["assetID"]); 303 item.AssetID = DBGuid.FromDB(reader["assetID"]);
311 item.AssetType = (int) reader["assetType"]; 304 item.AssetType = (int) reader["assetType"];
312 item.Folder = new UUID((string) reader["parentFolderID"]); 305 item.Folder = DBGuid.FromDB(reader["parentFolderID"]);
313 item.Name = (string)(reader["inventoryName"] ?? String.Empty); 306 item.Name = (string)(reader["inventoryName"] ?? String.Empty);
314 item.Description = (string)(reader["inventoryDescription"] ?? String.Empty); 307 item.Description = (string)(reader["inventoryDescription"] ?? String.Empty);
315 item.NextPermissions = (uint) reader["inventoryNextPermissions"]; 308 item.NextPermissions = (uint) reader["inventoryNextPermissions"];
@@ -382,9 +375,9 @@ namespace OpenSim.Data.MySQL
382 try 375 try
383 { 376 {
384 InventoryFolderBase folder = new InventoryFolderBase(); 377 InventoryFolderBase folder = new InventoryFolderBase();
385 folder.Owner = new UUID((string) reader["agentID"]); 378 folder.Owner = DBGuid.FromDB(reader["agentID"]);
386 folder.ParentID = new UUID((string) reader["parentFolderID"]); 379 folder.ParentID = DBGuid.FromDB(reader["parentFolderID"]);
387 folder.ID = new UUID((string) reader["folderID"]); 380 folder.ID = DBGuid.FromDB(reader["folderID"]);
388 folder.Name = (string) reader["folderName"]; 381 folder.Name = (string) reader["folderName"];
389 folder.Type = (short) reader["type"]; 382 folder.Type = (short) reader["type"];
390 folder.Version = (ushort) ((int) reader["version"]); 383 folder.Version = (ushort) ((int) reader["version"]);