* 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)0.6.0-stable
parent
f57ff4c36b
commit
8ed9e57896
|
@ -321,6 +321,13 @@ namespace OpenSim.Data.MSSQL
|
||||||
item.Creator = new LLUUID((string) reader["creatorID"]);
|
item.Creator = new LLUUID((string) reader["creatorID"]);
|
||||||
item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
|
item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
|
||||||
item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
|
item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
|
||||||
|
item.SalePrice = (int) reader["salePrice"];
|
||||||
|
item.SaleType = Convert.ToByte(reader["saleType"]);
|
||||||
|
item.CreationDate = (int) reader["creationDate"];
|
||||||
|
item.GroupID = new LLUUID(reader["groupID"].ToString());
|
||||||
|
item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
|
||||||
|
item.Flags = (uint) reader["flags"];
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
catch (SqlException e)
|
catch (SqlException e)
|
||||||
|
@ -440,9 +447,15 @@ namespace OpenSim.Data.MSSQL
|
||||||
|
|
||||||
string sql = "INSERT INTO inventoryitems";
|
string sql = "INSERT INTO inventoryitems";
|
||||||
sql +=
|
sql +=
|
||||||
"([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]) VALUES ";
|
"([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName]"
|
||||||
|
+ ", [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions]"
|
||||||
|
+ ", [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]"
|
||||||
|
+ ", [salePrice], [saleType], [creationDate], [groupID], [groupOwned], [flags]) VALUES ";
|
||||||
sql +=
|
sql +=
|
||||||
"(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, @inventoryBasePermissions, @inventoryEveryOnePermissions);";
|
"(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription"
|
||||||
|
+ ", @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID"
|
||||||
|
+ ", @inventoryBasePermissions, @inventoryEveryOnePermissions, @salePrice, @saleType"
|
||||||
|
+ ", @creationDate, @groupID, @groupOwned, @flags);";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -461,6 +474,13 @@ namespace OpenSim.Data.MSSQL
|
||||||
param["inventoryBasePermissions"] = Convert.ToString(item.BasePermissions);
|
param["inventoryBasePermissions"] = Convert.ToString(item.BasePermissions);
|
||||||
param["inventoryEveryOnePermissions"] = Convert.ToString(item.EveryOnePermissions);
|
param["inventoryEveryOnePermissions"] = Convert.ToString(item.EveryOnePermissions);
|
||||||
|
|
||||||
|
param["salePrice"] = Convert.ToString(item.SalePrice);
|
||||||
|
param["saleType"] = Convert.ToString(item.SaleType);
|
||||||
|
param["creationDate"] = Convert.ToString(item.CreationDate);
|
||||||
|
param["groupID"] = item.GroupID.ToString();
|
||||||
|
param["groupOwned"] = Convert.ToString(item.GroupOwned);
|
||||||
|
param["flags"] = Convert.ToString(item.Flags);
|
||||||
|
|
||||||
IDbCommand result = database.Query(sql, param);
|
IDbCommand result = database.Query(sql, param);
|
||||||
result.ExecuteNonQuery();
|
result.ExecuteNonQuery();
|
||||||
result.Dispose();
|
result.Dispose();
|
||||||
|
|
|
@ -19,10 +19,10 @@ CREATE TABLE [inventoryitems] (
|
||||||
[inventoryBasePermissions] [int] NOT NULL default 0,
|
[inventoryBasePermissions] [int] NOT NULL default 0,
|
||||||
[inventoryEveryOnePermissions] [int] NOT NULL default 0,
|
[inventoryEveryOnePermissions] [int] NOT NULL default 0,
|
||||||
[salePrice] [int] default NULL,
|
[salePrice] [int] default NULL,
|
||||||
[saleType] [smallint] default NULL,
|
[saleType] [tinyint] default NULL,
|
||||||
[creationDate] [int] default NULL,
|
[creationDate] [int] default NULL,
|
||||||
[groupID] [varchar](36) default NULL,
|
[groupID] [varchar](36) default NULL,
|
||||||
[groupOwned] [smallint] default NULL,
|
[groupOwned] [tinyint] default NULL,
|
||||||
[flags] [int] unsigned default NULL,
|
[flags] [int] unsigned default NULL,
|
||||||
PRIMARY KEY CLUSTERED
|
PRIMARY KEY CLUSTERED
|
||||||
(
|
(
|
||||||
|
|
|
@ -333,8 +333,6 @@ namespace OpenSim.Data.MySQL
|
||||||
item.Creator = new LLUUID((string) reader["creatorID"]);
|
item.Creator = new LLUUID((string) reader["creatorID"]);
|
||||||
item.BasePermissions = (uint) reader["inventoryBasePermissions"];
|
item.BasePermissions = (uint) reader["inventoryBasePermissions"];
|
||||||
item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
|
item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
|
||||||
|
|
||||||
// new fields
|
|
||||||
item.SalePrice = (int) reader["salePrice"];
|
item.SalePrice = (int) reader["salePrice"];
|
||||||
item.SaleType = Convert.ToByte(reader["saleType"]);
|
item.SaleType = Convert.ToByte(reader["saleType"]);
|
||||||
item.CreationDate = (int) reader["creationDate"];
|
item.CreationDate = (int) reader["creationDate"];
|
||||||
|
@ -452,9 +450,15 @@ namespace OpenSim.Data.MySQL
|
||||||
public void addInventoryItem(InventoryItemBase item)
|
public void addInventoryItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
string sql =
|
string sql =
|
||||||
"REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags) VALUES ";
|
"REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName"
|
||||||
|
+ ", inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType"
|
||||||
|
+ ", creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType"
|
||||||
|
+ ", creationDate, groupID, groupOwned, flags) VALUES ";
|
||||||
sql +=
|
sql +=
|
||||||
"(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?salePrice, ?saleType, ?creationDate, ?groupID, ?groupOwned, ?flags)";
|
"(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription"
|
||||||
|
+ ", ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID"
|
||||||
|
+ ", ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?salePrice, ?saleType, ?creationDate"
|
||||||
|
+ ", ?groupID, ?groupOwned, ?flags)";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue