diff options
author | Teravus Ovares | 2008-04-30 16:08:24 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-30 16:08:24 +0000 |
commit | a9cc76e0efba7496909d613c75b81de6a9c5d979 (patch) | |
tree | e83763d4dfb3b78ead9b5926dce1d2468b496845 /OpenSim/Data | |
parent | move IUserService into the OpenSim.Framework.Communications assembly (diff) | |
download | opensim-SC_OLD-a9cc76e0efba7496909d613c75b81de6a9c5d979.zip opensim-SC_OLD-a9cc76e0efba7496909d613c75b81de6a9c5d979.tar.gz opensim-SC_OLD-a9cc76e0efba7496909d613c75b81de6a9c5d979.tar.bz2 opensim-SC_OLD-a9cc76e0efba7496909d613c75b81de6a9c5d979.tar.xz |
* Long awaited patch from A_Biondi Mantis 923. Kept alive by Melanie. Thanks A_Biondi and Melanie!
* This builds but might not work. JustinCC will examine.. it may work out of the box.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLInventoryData.cs | 21 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/CreateItemsTable.sql | 8 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql | 8 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 32 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 2 |
5 files changed, 64 insertions, 7 deletions
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 6261d37..2c781e0 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -332,6 +332,15 @@ namespace OpenSim.Data.MySQL | |||
332 | item.Creator = new LLUUID((string) reader["creatorID"]); | 332 | item.Creator = new LLUUID((string) reader["creatorID"]); |
333 | item.BasePermissions = (uint) reader["inventoryBasePermissions"]; | 333 | item.BasePermissions = (uint) reader["inventoryBasePermissions"]; |
334 | item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; | 334 | item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; |
335 | |||
336 | // new fields | ||
337 | item.SalePrice = (int) reader["salePrice"]; | ||
338 | item.SaleType = Convert.ToByte(reader["saleType"]); | ||
339 | item.CreationDate = (int) reader["creationDate"]; | ||
340 | item.GroupID = new LLUUID(reader["groupID"].ToString()); | ||
341 | item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); | ||
342 | item.Flags = (uint) reader["flags"]; | ||
343 | |||
335 | return item; | 344 | return item; |
336 | } | 345 | } |
337 | catch (MySqlException e) | 346 | catch (MySqlException e) |
@@ -353,8 +362,6 @@ namespace OpenSim.Data.MySQL | |||
353 | { | 362 | { |
354 | lock (database) | 363 | lock (database) |
355 | { | 364 | { |
356 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
357 | |||
358 | MySqlCommand result = | 365 | MySqlCommand result = |
359 | new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection); | 366 | new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection); |
360 | result.Parameters.AddWithValue("?uuid", itemID.ToString()); | 367 | result.Parameters.AddWithValue("?uuid", itemID.ToString()); |
@@ -444,9 +451,9 @@ namespace OpenSim.Data.MySQL | |||
444 | public void addInventoryItem(InventoryItemBase item) | 451 | public void addInventoryItem(InventoryItemBase item) |
445 | { | 452 | { |
446 | string sql = | 453 | string sql = |
447 | "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions) VALUES "; | 454 | "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags) VALUES "; |
448 | sql += | 455 | sql += |
449 | "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)"; | 456 | "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?salePrice, ?saleType, ?creationDate, ?groupID, ?groupOwned, ?flags)"; |
450 | 457 | ||
451 | try | 458 | try |
452 | { | 459 | { |
@@ -465,6 +472,12 @@ namespace OpenSim.Data.MySQL | |||
465 | result.Parameters.AddWithValue("?creatorID", item.Creator.ToString()); | 472 | result.Parameters.AddWithValue("?creatorID", item.Creator.ToString()); |
466 | result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions); | 473 | result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions); |
467 | result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); | 474 | result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); |
475 | result.Parameters.AddWithValue("?salePrice", item.SalePrice); | ||
476 | result.Parameters.AddWithValue("?saleType", item.SaleType); | ||
477 | result.Parameters.AddWithValue("?creationDate", item.CreationDate); | ||
478 | result.Parameters.AddWithValue("?groupID", item.GroupID); | ||
479 | result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); | ||
480 | result.Parameters.AddWithValue("?flags", item.Flags); | ||
468 | 481 | ||
469 | lock (database) | 482 | lock (database) |
470 | { | 483 | { |
diff --git a/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql b/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql index 1723ee3..c8b7481 100644 --- a/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql +++ b/OpenSim/Data/MySQL/Resources/CreateItemsTable.sql | |||
@@ -12,7 +12,13 @@ CREATE TABLE `inventoryitems` ( | |||
12 | `creatorID` varchar(36) default NULL, | 12 | `creatorID` varchar(36) default NULL, |
13 | `inventoryBasePermissions` int(10) unsigned NOT NULL default 0, | 13 | `inventoryBasePermissions` int(10) unsigned NOT NULL default 0, |
14 | `inventoryEveryOnePermissions` int(10) unsigned NOT NULL default 0, | 14 | `inventoryEveryOnePermissions` int(10) unsigned NOT NULL default 0, |
15 | `salePrice` int(11) default NULL, | ||
16 | `saleType` tinyint(4) default NULL, | ||
17 | `creationDate` int(11) default NULL, | ||
18 | `groupID` varchar(63) default NULL, | ||
19 | `groupOwned` tinyint(4) default NULL, | ||
20 | `flags` int(11) unsigned default NULL, | ||
15 | PRIMARY KEY (`inventoryID`), | 21 | PRIMARY KEY (`inventoryID`), |
16 | KEY `owner` (`avatarID`), | 22 | KEY `owner` (`avatarID`), |
17 | KEY `folder` (`parentFolderID`) | 23 | KEY `folder` (`parentFolderID`) |
18 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 2'; | 24 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 3'; |
diff --git a/OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql b/OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql new file mode 100644 index 0000000..2b3b1f7 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/UpgradeItemsTableToVersion3.sql | |||
@@ -0,0 +1,8 @@ | |||
1 | ALTER TABLE `inventoryitems` | ||
2 | ADD COLUMN `salePrice` int(11) NOT NULL, | ||
3 | ADD COLUMN `saleType` tinyint(4) NOT NULL, | ||
4 | ADD COLUMN `creationDate` int(11) NOT NULL, | ||
5 | ADD COLUMN `groupID` varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000', | ||
6 | ADD COLUMN `groupOwned` tinyint(4) NOT NULL, | ||
7 | ADD COLUMN `flags` int(11) unsigned NOT NULL, | ||
8 | COMMENT='Rev. 3'; | ||
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 5c53f32..b638528 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs | |||
@@ -101,6 +101,14 @@ namespace OpenSim.Data.SQLite | |||
101 | item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]); | 101 | item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]); |
102 | item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]); | 102 | item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]); |
103 | item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]); | 103 | item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]); |
104 | |||
105 | // new fields | ||
106 | item.SalePrice = Convert.ToInt32(row["salePrice"]); | ||
107 | item.SaleType = Convert.ToByte(row["saleType"]); | ||
108 | item.CreationDate = Convert.ToInt32(row["creationDate"]); | ||
109 | item.GroupID = new LLUUID((string)row["groupID"]); | ||
110 | item.GroupOwned = Convert.ToBoolean(row["groupOwned"]); | ||
111 | item.Flags = Convert.ToUInt32(row["Flags"]); | ||
104 | return item; | 112 | return item; |
105 | } | 113 | } |
106 | 114 | ||
@@ -120,6 +128,14 @@ namespace OpenSim.Data.SQLite | |||
120 | row["inventoryCurrentPermissions"] = item.CurrentPermissions; | 128 | row["inventoryCurrentPermissions"] = item.CurrentPermissions; |
121 | row["inventoryBasePermissions"] = item.BasePermissions; | 129 | row["inventoryBasePermissions"] = item.BasePermissions; |
122 | row["inventoryEveryOnePermissions"] = item.EveryOnePermissions; | 130 | row["inventoryEveryOnePermissions"] = item.EveryOnePermissions; |
131 | |||
132 | // new fields | ||
133 | row["salePrice"] = item.SalePrice; | ||
134 | row["saleType"] = item.SaleType; | ||
135 | row["creationDate"] = item.CreationDate; | ||
136 | row["groupID"] = item.GroupID; | ||
137 | row["groupOwned"] = item.GroupOwned; | ||
138 | row["flags"] = item.Flags; | ||
123 | } | 139 | } |
124 | 140 | ||
125 | private void addFolder(InventoryFolderBase folder, bool add) | 141 | private void addFolder(InventoryFolderBase folder, bool add) |
@@ -530,7 +546,21 @@ namespace OpenSim.Data.SQLite | |||
530 | createCol(inv, "inventoryBasePermissions", typeof (Int32)); | 546 | createCol(inv, "inventoryBasePermissions", typeof (Int32)); |
531 | createCol(inv, "inventoryEveryOnePermissions", typeof (Int32)); | 547 | createCol(inv, "inventoryEveryOnePermissions", typeof (Int32)); |
532 | 548 | ||
533 | inv.PrimaryKey = new DataColumn[] {inv.Columns["UUID"]}; | 549 | // sale info |
550 | createCol(inv, "salePrice", typeof(Int32)); | ||
551 | createCol(inv, "saleType", typeof(Byte)); | ||
552 | |||
553 | // creation date | ||
554 | createCol(inv, "creationDate", typeof(Int32)); | ||
555 | |||
556 | // group info | ||
557 | createCol(inv, "groupID", typeof(String)); | ||
558 | createCol(inv, "groupOwned", typeof(Boolean)); | ||
559 | |||
560 | // Flags | ||
561 | createCol(inv, "flags", typeof(UInt32)); | ||
562 | |||
563 | inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] }; | ||
534 | return inv; | 564 | return inv; |
535 | } | 565 | } |
536 | 566 | ||
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 4355033..d385376 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -721,7 +721,7 @@ namespace OpenSim.Data.SQLite | |||
721 | createCol(items, "everyonePermissions", typeof (UInt32)); | 721 | createCol(items, "everyonePermissions", typeof (UInt32)); |
722 | createCol(items, "groupPermissions", typeof (UInt32)); | 722 | createCol(items, "groupPermissions", typeof (UInt32)); |
723 | 723 | ||
724 | items.PrimaryKey = new DataColumn[] {items.Columns["itemID"]}; | 724 | items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] }; |
725 | 725 | ||
726 | return items; | 726 | return items; |
727 | } | 727 | } |