aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLXInventoryData.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-02-08 21:39:46 +0000
committerJustin Clark-Casey (justincc)2010-02-08 21:39:46 +0000
commitaba59088604bbc422af7f670226e1b5c91acab41 (patch)
tree9896e48143101a20eddf38921ad646702f48146b /OpenSim/Data/MySQL/MySQLXInventoryData.cs
parentadd some method doc to IDynamicTextureManager (diff)
parentAdding the Careminster "Configger" tool to OpenSim. The tool will, when launched (diff)
downloadopensim-SC_OLD-aba59088604bbc422af7f670226e1b5c91acab41.zip
opensim-SC_OLD-aba59088604bbc422af7f670226e1b5c91acab41.tar.gz
opensim-SC_OLD-aba59088604bbc422af7f670226e1b5c91acab41.tar.bz2
opensim-SC_OLD-aba59088604bbc422af7f670226e1b5c91acab41.tar.xz
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLXInventoryData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLXInventoryData.cs65
1 files changed, 38 insertions, 27 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
index 0eebc9c..b5866cb 100644
--- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
@@ -110,47 +110,58 @@ namespace OpenSim.Data.MySQL
110 110
111 public bool MoveItem(string id, string newParent) 111 public bool MoveItem(string id, string newParent)
112 { 112 {
113 MySqlCommand cmd = new MySqlCommand(); 113 using (MySqlCommand cmd = new MySqlCommand())
114 {
114 115
115 cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm); 116 cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm);
116 cmd.Parameters.AddWithValue("?ParentFolderID", newParent); 117 cmd.Parameters.AddWithValue("?ParentFolderID", newParent);
117 cmd.Parameters.AddWithValue("?InventoryID", id); 118 cmd.Parameters.AddWithValue("?InventoryID", id);
118 119
119 return ExecuteNonQuery(cmd) == 0 ? false : true; 120 return ExecuteNonQuery(cmd) == 0 ? false : true;
121 }
120 } 122 }
121 123
122 public XInventoryItem[] GetActiveGestures(UUID principalID) 124 public XInventoryItem[] GetActiveGestures(UUID principalID)
123 { 125 {
124 MySqlCommand cmd = new MySqlCommand(); 126 using (MySqlCommand cmd = new MySqlCommand())
125 cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags = 1", m_Realm); 127 {
128 cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags = 1", m_Realm);
126 129
127 cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); 130 cmd.Parameters.AddWithValue("?uuid", principalID.ToString());
128 cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); 131 cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
129 132
130 return DoQuery(cmd); 133 return DoQuery(cmd);
134 }
131 } 135 }
132 136
133 public int GetAssetPermissions(UUID principalID, UUID assetID) 137 public int GetAssetPermissions(UUID principalID, UUID assetID)
134 { 138 {
135 MySqlCommand cmd = new MySqlCommand(); 139 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
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 { 140 {
147 perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]); 141 dbcon.Open();
142
143 using (MySqlCommand cmd = new MySqlCommand())
144 {
145 cmd.Connection = dbcon;
146
147 cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm);
148 cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
149 cmd.Parameters.AddWithValue("?AssetID", assetID.ToString());
150
151 using (IDataReader reader = cmd.ExecuteReader())
152 {
153
154 int perms = 0;
155
156 if (reader.Read())
157 {
158 perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]);
159 }
160
161 return perms;
162 }
163 }
148 } 164 }
149
150 reader.Close();
151 CloseReaderCommand(cmd);
152
153 return perms;
154 } 165 }
155 } 166 }
156} 167}