aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteGenericTableHandler.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/SQLite/SQLiteGenericTableHandler.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-80457111e0779f296080f4e26c6e56ac1263cba4.zip
opensim-SC-80457111e0779f296080f4e26c6e56ac1263cba4.tar.gz
opensim-SC-80457111e0779f296080f4e26c6e56ac1263cba4.tar.bz2
opensim-SC-80457111e0779f296080f4e26c6e56ac1263cba4.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs')
-rw-r--r--OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs28
1 files changed, 22 insertions, 6 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
index 0d7b001..3fb2d3f 100644
--- a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
+++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
@@ -258,17 +258,33 @@ namespace OpenSim.Data.SQLite
258 return false; 258 return false;
259 } 259 }
260 260
261 public bool Delete(string field, string val) 261 public virtual bool Delete(string field, string key)
262 { 262 {
263 return Delete(new string[] { field }, new string[] { key });
264 }
265
266 public bool Delete(string[] fields, string[] keys)
267 {
268 if (fields.Length != keys.Length)
269 return false;
270
271 List<string> terms = new List<string>();
272
263 SqliteCommand cmd = new SqliteCommand(); 273 SqliteCommand cmd = new SqliteCommand();
264 274
265 cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field); 275 for (int i = 0 ; i < fields.Length ; i++)
266 cmd.Parameters.Add(new SqliteParameter(field, val)); 276 {
277 cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
278 terms.Add("`" + fields[i] + "` = :" + fields[i]);
279 }
280
281 string where = String.Join(" and ", terms.ToArray());
267 282
268 if (ExecuteNonQuery(cmd, m_Connection) > 0) 283 string query = String.Format("delete * from {0} where {1}", m_Realm, where);
269 return true;
270 284
271 return false; 285 cmd.CommandText = query;
286
287 return ExecuteNonQuery(cmd, m_Connection) > 0;
272 } 288 }
273 } 289 }
274} 290}