aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-04-08 17:50:57 +0000
committerJustin Clarke Casey2009-04-08 17:50:57 +0000
commitf3c7298fc5bdb35e8a293c9aee4134c8e8fe2856 (patch)
treecdcef4e023e1adf8bb4a83e5ebe81448dbf33c6b /OpenSim/Data
parent* Fix the remainder of the packets that require sessionId checks. (diff)
downloadopensim-SC-f3c7298fc5bdb35e8a293c9aee4134c8e8fe2856.zip
opensim-SC-f3c7298fc5bdb35e8a293c9aee4134c8e8fe2856.tar.gz
opensim-SC-f3c7298fc5bdb35e8a293c9aee4134c8e8fe2856.tar.bz2
opensim-SC-f3c7298fc5bdb35e8a293c9aee4134c8e8fe2856.tar.xz
* Make it possible to store creator strings in user inventory items as well as UUIDs
* All existing functionality should be unaffected. * Database schemas have not been changed.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs27
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs12
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs8
-rw-r--r--OpenSim/Data/Tests/BasicInventoryTest.cs2
-rw-r--r--OpenSim/Data/Tests/BasicRegionTest.cs4
5 files changed, 26 insertions, 27 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index fe8287d..6a4fbab 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -181,7 +181,7 @@ namespace OpenSim.Data.MSSQL
181 } 181 }
182 } 182 }
183 } 183 }
184 m_log.InfoFormat("[INVENTORY DB] : FOund no inventory folder with ID : {0}", folderID); 184 m_log.InfoFormat("[INVENTORY DB] : Found no inventory folder with ID : {0}", folderID);
185 return null; 185 return null;
186 } 186 }
187 187
@@ -244,7 +244,7 @@ namespace OpenSim.Data.MSSQL
244 } 244 }
245 catch (Exception e) 245 catch (Exception e)
246 { 246 {
247 m_log.ErrorFormat("[ASSET DB] Error : {0}", e.Message); 247 m_log.ErrorFormat("[INVENTORY DB]: Error : {0}", e.Message);
248 } 248 }
249 } 249 }
250 } 250 }
@@ -277,7 +277,7 @@ namespace OpenSim.Data.MSSQL
277 } 277 }
278 catch (Exception e) 278 catch (Exception e)
279 { 279 {
280 m_log.ErrorFormat("[ASSET DB] Error : {0}", e.Message); 280 m_log.ErrorFormat("[INVENTORY DB]: Error : {0}", e.Message);
281 } 281 }
282 } 282 }
283 } 283 }
@@ -300,7 +300,7 @@ namespace OpenSim.Data.MSSQL
300 } 300 }
301 catch (Exception e) 301 catch (Exception e)
302 { 302 {
303 m_log.ErrorFormat("[ASSET DB] Error : {0}", e.Message); 303 m_log.ErrorFormat("[INVENTORY DB]: Error : {0}", e.Message);
304 } 304 }
305 } 305 }
306 } 306 }
@@ -385,7 +385,8 @@ namespace OpenSim.Data.MSSQL
385 } 385 }
386 } 386 }
387 } 387 }
388 m_log.InfoFormat("[INVENTORY DB] : Found no inventory item with ID : {0}", itemID); 388
389 m_log.InfoFormat("[INVENTORY DB]: Found no inventory item with ID : {0}", itemID);
389 return null; 390 return null;
390 } 391 }
391 392
@@ -424,7 +425,7 @@ namespace OpenSim.Data.MSSQL
424 command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions)); 425 command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions));
425 command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions)); 426 command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions));
426 command.Parameters.Add(database.CreateParameter("invType", item.InvType)); 427 command.Parameters.Add(database.CreateParameter("invType", item.InvType));
427 command.Parameters.Add(database.CreateParameter("creatorID", item.Creator)); 428 command.Parameters.Add(database.CreateParameter("creatorID", item.CreatorId));
428 command.Parameters.Add(database.CreateParameter("inventoryBasePermissions", item.BasePermissions)); 429 command.Parameters.Add(database.CreateParameter("inventoryBasePermissions", item.BasePermissions));
429 command.Parameters.Add(database.CreateParameter("inventoryEveryOnePermissions", item.EveryOnePermissions)); 430 command.Parameters.Add(database.CreateParameter("inventoryEveryOnePermissions", item.EveryOnePermissions));
430 command.Parameters.Add(database.CreateParameter("inventoryGroupPermissions", item.GroupPermissions)); 431 command.Parameters.Add(database.CreateParameter("inventoryGroupPermissions", item.GroupPermissions));
@@ -441,7 +442,7 @@ namespace OpenSim.Data.MSSQL
441 } 442 }
442 catch (Exception e) 443 catch (Exception e)
443 { 444 {
444 m_log.Error("[INVENTORY DB] Error inserting item :" + e.Message); 445 m_log.Error("[INVENTORY DB]: Error inserting item :" + e.Message);
445 } 446 }
446 } 447 }
447 448
@@ -498,7 +499,7 @@ namespace OpenSim.Data.MSSQL
498 command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions)); 499 command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions));
499 command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions)); 500 command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions));
500 command.Parameters.Add(database.CreateParameter("invType", item.InvType)); 501 command.Parameters.Add(database.CreateParameter("invType", item.InvType));
501 command.Parameters.Add(database.CreateParameter("creatorID", item.Creator)); 502 command.Parameters.Add(database.CreateParameter("creatorID", item.CreatorIdAsUuid));
502 command.Parameters.Add(database.CreateParameter("inventoryBasePermissions", item.BasePermissions)); 503 command.Parameters.Add(database.CreateParameter("inventoryBasePermissions", item.BasePermissions));
503 command.Parameters.Add(database.CreateParameter("inventoryEveryOnePermissions", item.EveryOnePermissions)); 504 command.Parameters.Add(database.CreateParameter("inventoryEveryOnePermissions", item.EveryOnePermissions));
504 command.Parameters.Add(database.CreateParameter("salePrice", item.SalePrice)); 505 command.Parameters.Add(database.CreateParameter("salePrice", item.SalePrice));
@@ -515,7 +516,7 @@ namespace OpenSim.Data.MSSQL
515 } 516 }
516 catch (Exception e) 517 catch (Exception e)
517 { 518 {
518 m_log.Error("[INVENTORY DB] Error updating item :" + e.Message); 519 m_log.Error("[INVENTORY DB]: Error updating item :" + e.Message);
519 } 520 }
520 } 521 }
521 } 522 }
@@ -538,7 +539,7 @@ namespace OpenSim.Data.MSSQL
538 } 539 }
539 catch (Exception e) 540 catch (Exception e)
540 { 541 {
541 m_log.Error("[INVENTORY DB] Error deleting item :" + e.Message); 542 m_log.Error("[INVENTORY DB]: Error deleting item :" + e.Message);
542 } 543 }
543 } 544 }
544 } 545 }
@@ -725,7 +726,7 @@ namespace OpenSim.Data.MSSQL
725 item.NextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]); 726 item.NextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]);
726 item.CurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]); 727 item.CurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]);
727 item.InvType = Convert.ToInt32(reader["invType"].ToString()); 728 item.InvType = Convert.ToInt32(reader["invType"].ToString());
728 item.Creator = new UUID((Guid)reader["creatorID"]); 729 item.CreatorId = ((Guid)reader["creatorID"]).ToString();
729 item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); 730 item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
730 item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); 731 item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
731 item.GroupPermissions = Convert.ToUInt32(reader["inventoryGroupPermissions"]); 732 item.GroupPermissions = Convert.ToUInt32(reader["inventoryGroupPermissions"]);
@@ -740,7 +741,7 @@ namespace OpenSim.Data.MSSQL
740 } 741 }
741 catch (SqlException e) 742 catch (SqlException e)
742 { 743 {
743 m_log.Error("[INVENTORY DB] Error reading inventory item :" + e.Message); 744 m_log.Error("[INVENTORY DB]: Error reading inventory item :" + e.Message);
744 } 745 }
745 746
746 return null; 747 return null;
@@ -764,7 +765,7 @@ namespace OpenSim.Data.MSSQL
764 } 765 }
765 catch (SqlException e) 766 catch (SqlException e)
766 { 767 {
767 m_log.Error("[INVENTORY DB] Error deleting folder :" + e.Message); 768 m_log.Error("[INVENTORY DB]: Error deleting folder :" + e.Message);
768 } 769 }
769 } 770 }
770 771
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index a5312b5..7092096 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -306,22 +306,20 @@ namespace OpenSim.Data.MySQL
306 try 306 try
307 { 307 {
308 InventoryItemBase item = new InventoryItemBase(); 308 InventoryItemBase item = new InventoryItemBase();
309 item.CreatorId = (string)reader["creatorID"];
310
309 // Be a bit safer in parsing these because the 311 // Be a bit safer in parsing these because the
310 // database doesn't enforce them to be not null, and 312 // database doesn't enforce them to be not null, and
311 // the inventory still works if these are weird in the 313 // the inventory still works if these are weird in the
312 // db 314 // db
313
314 UUID Owner = UUID.Zero; 315 UUID Owner = UUID.Zero;
315 UUID Creator = UUID.Zero;
316 UUID GroupID = UUID.Zero; 316 UUID GroupID = UUID.Zero;
317 UUID.TryParse((string)reader["avatarID"], out Owner); 317 UUID.TryParse((string)reader["avatarID"], out Owner);
318 UUID.TryParse((string)reader["creatorID"], out Creator);
319 UUID.TryParse((string)reader["groupID"], out GroupID); 318 UUID.TryParse((string)reader["groupID"], out GroupID);
320 item.Owner = Owner; 319 item.Owner = Owner;
321 item.Creator = Creator;
322 item.GroupID = GroupID; 320 item.GroupID = GroupID;
323 321
324 // Rest of the parsing. If these UUID's fail, we're dead anyway 322 // Rest of the parsing. If these UUID's fail, we're dead anyway
325 item.ID = new UUID((string) reader["inventoryID"]); 323 item.ID = new UUID((string) reader["inventoryID"]);
326 item.AssetID = new UUID((string) reader["assetID"]); 324 item.AssetID = new UUID((string) reader["assetID"]);
327 item.AssetType = (int) reader["assetType"]; 325 item.AssetType = (int) reader["assetType"];
@@ -480,7 +478,7 @@ namespace OpenSim.Data.MySQL
480 result.Parameters.AddWithValue("?inventoryCurrentPermissions", 478 result.Parameters.AddWithValue("?inventoryCurrentPermissions",
481 item.CurrentPermissions.ToString()); 479 item.CurrentPermissions.ToString());
482 result.Parameters.AddWithValue("?invType", item.InvType); 480 result.Parameters.AddWithValue("?invType", item.InvType);
483 result.Parameters.AddWithValue("?creatorID", item.Creator.ToString()); 481 result.Parameters.AddWithValue("?creatorID", item.CreatorId);
484 result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions); 482 result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
485 result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); 483 result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
486 result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions); 484 result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index bd18c11..aedcd82 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -143,7 +143,7 @@ namespace OpenSim.Data.SQLite
143 item.InvType = Convert.ToInt32(row["invType"]); 143 item.InvType = Convert.ToInt32(row["invType"]);
144 item.Folder = new UUID((string) row["parentFolderID"]); 144 item.Folder = new UUID((string) row["parentFolderID"]);
145 item.Owner = new UUID((string) row["avatarID"]); 145 item.Owner = new UUID((string) row["avatarID"]);
146 item.Creator = new UUID((string) row["creatorsID"]); 146 item.CreatorId = (string)row["creatorsID"];
147 item.Name = (string) row["inventoryName"]; 147 item.Name = (string) row["inventoryName"];
148 item.Description = (string) row["inventoryDescription"]; 148 item.Description = (string) row["inventoryDescription"];
149 149
@@ -176,7 +176,7 @@ namespace OpenSim.Data.SQLite
176 } 176 }
177 177
178 /// <summary> 178 /// <summary>
179 /// 179 /// Fill a database row with item data
180 /// </summary> 180 /// </summary>
181 /// <param name="row"></param> 181 /// <param name="row"></param>
182 /// <param name="item"></param> 182 /// <param name="item"></param>
@@ -188,7 +188,7 @@ namespace OpenSim.Data.SQLite
188 row["invType"] = item.InvType; 188 row["invType"] = item.InvType;
189 row["parentFolderID"] = Util.ToRawUuidString(item.Folder); 189 row["parentFolderID"] = Util.ToRawUuidString(item.Folder);
190 row["avatarID"] = Util.ToRawUuidString(item.Owner); 190 row["avatarID"] = Util.ToRawUuidString(item.Owner);
191 row["creatorsID"] = Util.ToRawUuidString(item.Creator); 191 row["creatorsID"] = Util.ToRawUuidString(item.CreatorIdAsUuid);
192 row["inventoryName"] = item.Name; 192 row["inventoryName"] = item.Name;
193 row["inventoryDescription"] = item.Description; 193 row["inventoryDescription"] = item.Description;
194 194
@@ -281,7 +281,7 @@ namespace OpenSim.Data.SQLite
281 DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(item.ID)); 281 DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(item.ID));
282 if (inventoryRow == null) 282 if (inventoryRow == null)
283 { 283 {
284 if (! add) 284 if (!add)
285 m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.ID); 285 m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.ID);
286 286
287 inventoryRow = inventoryItemTable.NewRow(); 287 inventoryRow = inventoryItemTable.NewRow();
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/BasicInventoryTest.cs
index 65c61cd..eed6cab 100644
--- a/OpenSim/Data/Tests/BasicInventoryTest.cs
+++ b/OpenSim/Data/Tests/BasicInventoryTest.cs
@@ -271,7 +271,7 @@ namespace OpenSim.Data.Tests
271 i.ID = id; 271 i.ID = id;
272 i.Folder = parent; 272 i.Folder = parent;
273 i.Owner = owner; 273 i.Owner = owner;
274 i.Creator = owner; 274 i.CreatorId = owner.ToString();
275 i.Name = name; 275 i.Name = name;
276 i.Description = name; 276 i.Description = name;
277 i.AssetID = asset; 277 i.AssetID = asset;
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs
index e7ce8af..0e87c8c 100644
--- a/OpenSim/Data/Tests/BasicRegionTest.cs
+++ b/OpenSim/Data/Tests/BasicRegionTest.cs
@@ -606,7 +606,7 @@ namespace OpenSim.Data.Tests
606 UUID owner = UUID.Random(); 606 UUID owner = UUID.Random();
607 i.Owner = owner; 607 i.Owner = owner;
608 UUID creator = UUID.Random(); 608 UUID creator = UUID.Random();
609 i.Creator = creator; 609 i.CreatorId = creator.ToString();
610 string name = RandomName(); 610 string name = RandomName();
611 i.Name = name; 611 i.Name = name;
612 i.Description = name; 612 i.Description = name;
@@ -982,7 +982,7 @@ namespace OpenSim.Data.Tests
982 i.ID = id; 982 i.ID = id;
983 i.Folder = parent; 983 i.Folder = parent;
984 i.Owner = owner; 984 i.Owner = owner;
985 i.Creator = owner; 985 i.CreatorId = owner.ToString();
986 i.Name = name; 986 i.Name = name;
987 i.Description = name; 987 i.Description = name;
988 i.AssetID = asset; 988 i.AssetID = asset;