From 1ae9bfc0746b97f57031f282d4f6721b08c27f0c Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 4 Jan 2010 20:52:44 +0000 Subject: Finish conversion if XInventoryService --- OpenSim/Data/MySQL/MySQLXInventoryData.cs | 55 +++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'OpenSim/Data/MySQL/MySQLXInventoryData.cs') diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index dd3e6ea..0eebc9c 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs @@ -85,9 +85,19 @@ namespace OpenSim.Data.MySQL return m_Items.Delete(field, val); } - public bool MoveItem(string principalID, string id, string newParent) + public bool MoveItem(string id, string newParent) { - return m_Items.MoveItem(principalID, id, newParent); + return m_Items.MoveItem(id, newParent); + } + + public XInventoryItem[] GetActiveGestures(UUID principalID) + { + return m_Items.GetActiveGestures(principalID); + } + + public int GetAssetPermissions(UUID principalID, UUID assetID) + { + return m_Items.GetAssetPermissions(principalID, assetID); } } @@ -98,16 +108,49 @@ namespace OpenSim.Data.MySQL { } - public bool MoveItem(string principalID, string id, string newParent) + public bool MoveItem(string id, string newParent) { MySqlCommand cmd = new MySqlCommand(); - cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where agentID = ?AgentID and folderID = ?FolderID"); + cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm); cmd.Parameters.AddWithValue("?ParentFolderID", newParent); - cmd.Parameters.AddWithValue("?FolderID", id); - cmd.Parameters.AddWithValue("?AgentID", principalID); + cmd.Parameters.AddWithValue("?InventoryID", id); return ExecuteNonQuery(cmd) == 0 ? false : true; } + + public XInventoryItem[] GetActiveGestures(UUID principalID) + { + MySqlCommand cmd = new MySqlCommand(); + cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags = 1", m_Realm); + + cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); + cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); + + return DoQuery(cmd); + } + + public int GetAssetPermissions(UUID principalID, UUID assetID) + { + MySqlCommand cmd = new MySqlCommand(); + + cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm); + cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); + cmd.Parameters.AddWithValue("?AssetID", assetID.ToString()); + + IDataReader reader = ExecuteReader(cmd); + + int perms = 0; + + if (reader.Read()) + { + perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]); + } + + reader.Close(); + CloseReaderCommand(cmd); + + return perms; + } } } -- cgit v1.1