diff options
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXInventoryData.cs | 55 |
1 files changed, 49 insertions, 6 deletions
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 | |||
85 | return m_Items.Delete(field, val); | 85 | return m_Items.Delete(field, val); |
86 | } | 86 | } |
87 | 87 | ||
88 | public bool MoveItem(string principalID, string id, string newParent) | 88 | public bool MoveItem(string id, string newParent) |
89 | { | 89 | { |
90 | return m_Items.MoveItem(principalID, id, newParent); | 90 | return m_Items.MoveItem(id, newParent); |
91 | } | ||
92 | |||
93 | public XInventoryItem[] GetActiveGestures(UUID principalID) | ||
94 | { | ||
95 | return m_Items.GetActiveGestures(principalID); | ||
96 | } | ||
97 | |||
98 | public int GetAssetPermissions(UUID principalID, UUID assetID) | ||
99 | { | ||
100 | return m_Items.GetAssetPermissions(principalID, assetID); | ||
91 | } | 101 | } |
92 | } | 102 | } |
93 | 103 | ||
@@ -98,16 +108,49 @@ namespace OpenSim.Data.MySQL | |||
98 | { | 108 | { |
99 | } | 109 | } |
100 | 110 | ||
101 | public bool MoveItem(string principalID, string id, string newParent) | 111 | public bool MoveItem(string id, string newParent) |
102 | { | 112 | { |
103 | MySqlCommand cmd = new MySqlCommand(); | 113 | MySqlCommand cmd = new MySqlCommand(); |
104 | 114 | ||
105 | cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where agentID = ?AgentID and folderID = ?FolderID"); | 115 | cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm); |
106 | cmd.Parameters.AddWithValue("?ParentFolderID", newParent); | 116 | cmd.Parameters.AddWithValue("?ParentFolderID", newParent); |
107 | cmd.Parameters.AddWithValue("?FolderID", id); | 117 | cmd.Parameters.AddWithValue("?InventoryID", id); |
108 | cmd.Parameters.AddWithValue("?AgentID", principalID); | ||
109 | 118 | ||
110 | return ExecuteNonQuery(cmd) == 0 ? false : true; | 119 | return ExecuteNonQuery(cmd) == 0 ? false : true; |
111 | } | 120 | } |
121 | |||
122 | public XInventoryItem[] GetActiveGestures(UUID principalID) | ||
123 | { | ||
124 | MySqlCommand cmd = new MySqlCommand(); | ||
125 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags = 1", m_Realm); | ||
126 | |||
127 | cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); | ||
128 | cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); | ||
129 | |||
130 | return DoQuery(cmd); | ||
131 | } | ||
132 | |||
133 | public int GetAssetPermissions(UUID principalID, UUID assetID) | ||
134 | { | ||
135 | MySqlCommand cmd = new MySqlCommand(); | ||
136 | |||
137 | cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm); | ||
138 | cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); | ||
139 | cmd.Parameters.AddWithValue("?AssetID", assetID.ToString()); | ||
140 | |||
141 | IDataReader reader = ExecuteReader(cmd); | ||
142 | |||
143 | int perms = 0; | ||
144 | |||
145 | if (reader.Read()) | ||
146 | { | ||
147 | perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]); | ||
148 | } | ||
149 | |||
150 | reader.Close(); | ||
151 | CloseReaderCommand(cmd); | ||
152 | |||
153 | return perms; | ||
154 | } | ||
112 | } | 155 | } |
113 | } | 156 | } |