aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLXInventoryData.cs
diff options
context:
space:
mode:
authorMelanie2010-02-08 15:53:20 +0000
committerMelanie2010-02-08 15:53:38 +0000
commitbaaf660511214e52ea4ed20b8e80ec8e1ff06a3a (patch)
tree1e90c7a22ea3354d6bfd5d2b3f8f64f199dbd477 /OpenSim/Data/MySQL/MySQLXInventoryData.cs
parentAdded missing configs to Standalone.ini (diff)
parentAdding the Careminster "Configger" tool to OpenSim. The tool will, when launched (diff)
downloadopensim-SC-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.zip
opensim-SC-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.tar.gz
opensim-SC-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.tar.bz2
opensim-SC-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.tar.xz
Merge branch 'master' into presence-refactor
This was a large, heavily conflicted merge and things MAY have got broken. Please check!
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}