aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-05-18 00:23:35 +0100
committerJustin Clark-Casey (justincc)2011-05-18 00:23:35 +0100
commit6dcc87b1adeb71a9c83cafa95a95a80c50b62092 (patch)
treef6a395bb05f3f5f3bb0bf05cd08e1d66aba7fcac /OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs
parentcorrect small mistake in "delete object name <name>" usage summary (diff)
downloadopensim-SC_OLD-6dcc87b1adeb71a9c83cafa95a95a80c50b62092.zip
opensim-SC_OLD-6dcc87b1adeb71a9c83cafa95a95a80c50b62092.tar.gz
opensim-SC_OLD-6dcc87b1adeb71a9c83cafa95a95a80c50b62092.tar.bz2
opensim-SC_OLD-6dcc87b1adeb71a9c83cafa95a95a80c50b62092.tar.xz
Accidentally committed too early
Revert "Allow item links to be deleted even when other deletes and purges are disabled." This reverts commit 491279f99afc65860d44765ee7829c7dd5e4e38e.
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs35
1 files changed, 12 insertions, 23 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs
index 317afac..f5492b3 100644
--- a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs
+++ b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs
@@ -335,35 +335,24 @@ namespace OpenSim.Data.MSSQL
335 } 335 }
336 } 336 }
337 337
338 public virtual bool Delete(string field, string key) 338 public virtual bool Delete(string field, string val)
339 { 339 {
340 return Delete(new string[] { field }, new string[] { key });
341 }
342
343 public virtual bool Delete(string[] fields, string[] keys)
344 {
345 if (fields.Length != keys.Length)
346 return false;
347
348 List<string> terms = new List<string>();
349
350 using (SqlConnection conn = new SqlConnection(m_ConnectionString)) 340 using (SqlConnection conn = new SqlConnection(m_ConnectionString))
351 using (SqlCommand cmd = new SqlCommand()) 341 using (SqlCommand cmd = new SqlCommand())
352 { 342 {
353 for (int i = 0; i < fields.Length; i++) 343 string deleteCommand = String.Format("DELETE FROM {0} WHERE [{1}] = @{1}", m_Realm, field);
354 { 344 cmd.CommandText = deleteCommand;
355 cmd.Parameters.Add(m_database.CreateParameter(fields[i], keys[i])); 345
356 terms.Add("[" + fields[i] + "] = @" + fields[i]); 346 cmd.Parameters.Add(m_database.CreateParameter(field, val));
357 }
358
359 string where = String.Join(" AND ", terms.ToArray());
360
361 string query = String.Format("DELETE * FROM {0} WHERE {1}", m_Realm, where);
362
363 cmd.Connection = conn; 347 cmd.Connection = conn;
364 cmd.CommandText = query;
365 conn.Open(); 348 conn.Open();
366 return cmd.ExecuteNonQuery() > 0; 349
350 if (cmd.ExecuteNonQuery() > 0)
351 {
352 //m_log.Warn("[MSSQLGenericTable]: " + deleteCommand);
353 return true;
354 }
355 return false;
367 } 356 }
368 } 357 }
369 } 358 }