aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
diff options
context:
space:
mode:
authorDiva Canto2011-05-21 14:07:30 -0700
committerDiva Canto2011-05-21 14:07:30 -0700
commit80457111e0779f296080f4e26c6e56ac1263cba4 (patch)
tree4a2df3859ad5f71be49a55add550c98a6af04f68 /OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
parentHG Friends working to some extent: friendships offered and accepted correctly... (diff)
parentGet rid of OpenSim.Tests.Common.Setup subpackage in favour of just OpenSim.Te... (diff)
downloadopensim-SC_OLD-80457111e0779f296080f4e26c6e56ac1263cba4.zip
opensim-SC_OLD-80457111e0779f296080f4e26c6e56ac1263cba4.tar.gz
opensim-SC_OLD-80457111e0779f296080f4e26c6e56ac1263cba4.tar.bz2
opensim-SC_OLD-80457111e0779f296080f4e26c6e56ac1263cba4.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLGenericTableHandler.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs27
1 files changed, 21 insertions, 6 deletions
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index cfffbd8..754cf72 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -264,18 +264,33 @@ namespace OpenSim.Data.MySQL
264 } 264 }
265 } 265 }
266 266
267 public virtual bool Delete(string field, string val) 267 public virtual bool Delete(string field, string key)
268 { 268 {
269 return Delete(new string[] { field }, new string[] { key });
270 }
271
272 public virtual bool Delete(string[] fields, string[] keys)
273 {
274 if (fields.Length != keys.Length)
275 return false;
276
277 List<string> terms = new List<string>();
278
269 using (MySqlCommand cmd = new MySqlCommand()) 279 using (MySqlCommand cmd = new MySqlCommand())
270 { 280 {
281 for (int i = 0 ; i < fields.Length ; i++)
282 {
283 cmd.Parameters.AddWithValue(fields[i], keys[i]);
284 terms.Add("`" + fields[i] + "` = ?" + fields[i]);
285 }
271 286
272 cmd.CommandText = String.Format("delete from {0} where `{1}` = ?{1}", m_Realm, field); 287 string where = String.Join(" and ", terms.ToArray());
273 cmd.Parameters.AddWithValue(field, val);
274 288
275 if (ExecuteNonQuery(cmd) > 0) 289 string query = String.Format("delete from {0} where {1}", m_Realm, where);
276 return true;
277 290
278 return false; 291 cmd.CommandText = query;
292
293 return ExecuteNonQuery(cmd) > 0;
279 } 294 }
280 } 295 }
281 } 296 }