aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-30 19:28:36 +0000
committerJustin Clarke Casey2008-04-30 19:28:36 +0000
commit8ed9e578968539ff991ffa8215e715c0e4c3be5d (patch)
tree36a5de69d383f9219d53cb17783331d97a911e3c /OpenSim
parent* Change new inventory groupID field to 36 rather than 63 (diff)
downloadopensim-SC_OLD-8ed9e578968539ff991ffa8215e715c0e4c3be5d.zip
opensim-SC_OLD-8ed9e578968539ff991ffa8215e715c0e4c3be5d.tar.gz
opensim-SC_OLD-8ed9e578968539ff991ffa8215e715c0e4c3be5d.tar.bz2
opensim-SC_OLD-8ed9e578968539ff991ffa8215e715c0e4c3be5d.tar.xz
* Add a scratch implementation of the new inventory fields to the mssql database adapter
* I don't use mssql so this may not work, corrections (in the form of patches) are welcome. * Unlike mysql, mssql requires manual updating of existing tables here (which should mean just adding the new fields manually)
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs26
-rw-r--r--OpenSim/Data/MSSQL/Resources/CreateItemsTable.sql4
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs12
3 files changed, 33 insertions, 9 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index c524fc0..e23178c 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -321,6 +321,13 @@ namespace OpenSim.Data.MSSQL
321 item.Creator = new LLUUID((string) reader["creatorID"]); 321 item.Creator = new LLUUID((string) reader["creatorID"]);
322 item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); 322 item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
323 item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); 323 item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
324 item.SalePrice = (int) reader["salePrice"];
325 item.SaleType = Convert.ToByte(reader["saleType"]);
326 item.CreationDate = (int) reader["creationDate"];
327 item.GroupID = new LLUUID(reader["groupID"].ToString());
328 item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
329 item.Flags = (uint) reader["flags"];
330
324 return item; 331 return item;
325 } 332 }
326 catch (SqlException e) 333 catch (SqlException e)
@@ -440,10 +447,16 @@ namespace OpenSim.Data.MSSQL
440 447
441 string sql = "INSERT INTO inventoryitems"; 448 string sql = "INSERT INTO inventoryitems";
442 sql += 449 sql +=
443 "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]) VALUES "; 450 "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName]"
451 + ", [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions]"
452 + ", [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]"
453 + ", [salePrice], [saleType], [creationDate], [groupID], [groupOwned], [flags]) VALUES ";
444 sql += 454 sql +=
445 "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, @inventoryBasePermissions, @inventoryEveryOnePermissions);"; 455 "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription"
446 456 + ", @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID"
457 + ", @inventoryBasePermissions, @inventoryEveryOnePermissions, @salePrice, @saleType"
458 + ", @creationDate, @groupID, @groupOwned, @flags);";
459
447 try 460 try
448 { 461 {
449 Dictionary<string, string> param = new Dictionary<string, string>(); 462 Dictionary<string, string> param = new Dictionary<string, string>();
@@ -460,6 +473,13 @@ namespace OpenSim.Data.MSSQL
460 param["creatorID"] = item.Creator.ToString(); 473 param["creatorID"] = item.Creator.ToString();
461 param["inventoryBasePermissions"] = Convert.ToString(item.BasePermissions); 474 param["inventoryBasePermissions"] = Convert.ToString(item.BasePermissions);
462 param["inventoryEveryOnePermissions"] = Convert.ToString(item.EveryOnePermissions); 475 param["inventoryEveryOnePermissions"] = Convert.ToString(item.EveryOnePermissions);
476
477 param["salePrice"] = Convert.ToString(item.SalePrice);
478 param["saleType"] = Convert.ToString(item.SaleType);
479 param["creationDate"] = Convert.ToString(item.CreationDate);
480 param["groupID"] = item.GroupID.ToString();
481 param["groupOwned"] = Convert.ToString(item.GroupOwned);
482 param["flags"] = Convert.ToString(item.Flags);
463 483
464 IDbCommand result = database.Query(sql, param); 484 IDbCommand result = database.Query(sql, param);
465 result.ExecuteNonQuery(); 485 result.ExecuteNonQuery();
diff --git a/OpenSim/Data/MSSQL/Resources/CreateItemsTable.sql b/OpenSim/Data/MSSQL/Resources/CreateItemsTable.sql
index 435d269..6f6bb43 100644
--- a/OpenSim/Data/MSSQL/Resources/CreateItemsTable.sql
+++ b/OpenSim/Data/MSSQL/Resources/CreateItemsTable.sql
@@ -19,10 +19,10 @@ CREATE TABLE [inventoryitems] (
19 [inventoryBasePermissions] [int] NOT NULL default 0, 19 [inventoryBasePermissions] [int] NOT NULL default 0,
20 [inventoryEveryOnePermissions] [int] NOT NULL default 0, 20 [inventoryEveryOnePermissions] [int] NOT NULL default 0,
21 [salePrice] [int] default NULL, 21 [salePrice] [int] default NULL,
22 [saleType] [smallint] default NULL, 22 [saleType] [tinyint] default NULL,
23 [creationDate] [int] default NULL, 23 [creationDate] [int] default NULL,
24 [groupID] [varchar](36) default NULL, 24 [groupID] [varchar](36) default NULL,
25 [groupOwned] [smallint] default NULL, 25 [groupOwned] [tinyint] default NULL,
26 [flags] [int] unsigned default NULL, 26 [flags] [int] unsigned default NULL,
27 PRIMARY KEY CLUSTERED 27 PRIMARY KEY CLUSTERED
28( 28(
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 944c2f5..23d2ea5 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -333,8 +333,6 @@ namespace OpenSim.Data.MySQL
333 item.Creator = new LLUUID((string) reader["creatorID"]); 333 item.Creator = new LLUUID((string) reader["creatorID"]);
334 item.BasePermissions = (uint) reader["inventoryBasePermissions"]; 334 item.BasePermissions = (uint) reader["inventoryBasePermissions"];
335 item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; 335 item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
336
337 // new fields
338 item.SalePrice = (int) reader["salePrice"]; 336 item.SalePrice = (int) reader["salePrice"];
339 item.SaleType = Convert.ToByte(reader["saleType"]); 337 item.SaleType = Convert.ToByte(reader["saleType"]);
340 item.CreationDate = (int) reader["creationDate"]; 338 item.CreationDate = (int) reader["creationDate"];
@@ -452,9 +450,15 @@ namespace OpenSim.Data.MySQL
452 public void addInventoryItem(InventoryItemBase item) 450 public void addInventoryItem(InventoryItemBase item)
453 { 451 {
454 string sql = 452 string sql =
455 "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags) VALUES "; 453 "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName"
454 + ", inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType"
455 + ", creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType"
456 + ", creationDate, groupID, groupOwned, flags) VALUES ";
456 sql += 457 sql +=
457 "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?salePrice, ?saleType, ?creationDate, ?groupID, ?groupOwned, ?flags)"; 458 "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription"
459 + ", ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID"
460 + ", ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?salePrice, ?saleType, ?creationDate"
461 + ", ?groupID, ?groupOwned, ?flags)";
458 462
459 try 463 try
460 { 464 {