diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/IXInventoryData.cs | 29 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs | 35 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLXInventoryData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 27 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 30 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXInventoryData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | 28 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 10 |
8 files changed, 140 insertions, 39 deletions
diff --git a/OpenSim/Data/IXInventoryData.cs b/OpenSim/Data/IXInventoryData.cs index d85a7ef..85a5c08 100644 --- a/OpenSim/Data/IXInventoryData.cs +++ b/OpenSim/Data/IXInventoryData.cs | |||
@@ -74,9 +74,38 @@ namespace OpenSim.Data | |||
74 | bool StoreFolder(XInventoryFolder folder); | 74 | bool StoreFolder(XInventoryFolder folder); |
75 | bool StoreItem(XInventoryItem item); | 75 | bool StoreItem(XInventoryItem item); |
76 | 76 | ||
77 | /// <summary> | ||
78 | /// Delete folders where field == val | ||
79 | /// </summary> | ||
80 | /// <param name="field"></param> | ||
81 | /// <param name="val"></param> | ||
82 | /// <returns>true if the delete was successful, false if it was not</returns> | ||
77 | bool DeleteFolders(string field, string val); | 83 | bool DeleteFolders(string field, string val); |
84 | |||
85 | /// <summary> | ||
86 | /// Delete folders where field1 == val1, field2 == val2... | ||
87 | /// </summary> | ||
88 | /// <param name="fields"></param> | ||
89 | /// <param name="vals"></param> | ||
90 | /// <returns>true if the delete was successful, false if it was not</returns> | ||
91 | bool DeleteFolders(string[] fields, string[] vals); | ||
92 | |||
93 | /// <summary> | ||
94 | /// Delete items where field == val | ||
95 | /// </summary> | ||
96 | /// <param name="field"></param> | ||
97 | /// <param name="val"></param> | ||
98 | /// <returns>true if the delete was successful, false if it was not</returns> | ||
78 | bool DeleteItems(string field, string val); | 99 | bool DeleteItems(string field, string val); |
79 | 100 | ||
101 | /// <summary> | ||
102 | /// Delete items where field1 == val1, field2 == val2... | ||
103 | /// </summary> | ||
104 | /// <param name="fields"></param> | ||
105 | /// <param name="vals"></param> | ||
106 | /// <returns>true if the delete was successful, false if it was not</returns> | ||
107 | bool DeleteItems(string[] fields, string[] vals); | ||
108 | |||
80 | bool MoveItem(string id, string newParent); | 109 | bool MoveItem(string id, string newParent); |
81 | XInventoryItem[] GetActiveGestures(UUID principalID); | 110 | XInventoryItem[] GetActiveGestures(UUID principalID); |
82 | int GetAssetPermissions(UUID principalID, UUID assetID); | 111 | int GetAssetPermissions(UUID principalID, UUID assetID); |
diff --git a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs index 19e8fa6..6e695ce 100644 --- a/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs +++ b/OpenSim/Data/MSSQL/MSSQLGenericTableHandler.cs | |||
@@ -335,24 +335,35 @@ namespace OpenSim.Data.MSSQL | |||
335 | } | 335 | } |
336 | } | 336 | } |
337 | 337 | ||
338 | public virtual bool Delete(string field, string val) | 338 | public virtual bool Delete(string field, string key) |
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 | |||
340 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) | 350 | using (SqlConnection conn = new SqlConnection(m_ConnectionString)) |
341 | using (SqlCommand cmd = new SqlCommand()) | 351 | using (SqlCommand cmd = new SqlCommand()) |
342 | { | 352 | { |
343 | string deleteCommand = String.Format("DELETE FROM {0} WHERE [{1}] = @{1}", m_Realm, field); | 353 | for (int i = 0; i < fields.Length; i++) |
344 | cmd.CommandText = deleteCommand; | ||
345 | |||
346 | cmd.Parameters.Add(m_database.CreateParameter(field, val)); | ||
347 | cmd.Connection = conn; | ||
348 | conn.Open(); | ||
349 | |||
350 | if (cmd.ExecuteNonQuery() > 0) | ||
351 | { | 354 | { |
352 | //m_log.Warn("[MSSQLGenericTable]: " + deleteCommand); | 355 | cmd.Parameters.Add(m_database.CreateParameter(fields[i], keys[i])); |
353 | return true; | 356 | terms.Add("[" + fields[i] + "] = @" + fields[i]); |
354 | } | 357 | } |
355 | return false; | 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; | ||
364 | cmd.CommandText = query; | ||
365 | conn.Open(); | ||
366 | return cmd.ExecuteNonQuery() > 0; | ||
356 | } | 367 | } |
357 | } | 368 | } |
358 | } | 369 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs index 739eb55..dc35a2e 100644 --- a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs | |||
@@ -79,11 +79,21 @@ namespace OpenSim.Data.MSSQL | |||
79 | return m_Folders.Delete(field, val); | 79 | return m_Folders.Delete(field, val); |
80 | } | 80 | } |
81 | 81 | ||
82 | public bool DeleteFolders(string[] fields, string[] vals) | ||
83 | { | ||
84 | return m_Folders.Delete(fields, vals); | ||
85 | } | ||
86 | |||
82 | public bool DeleteItems(string field, string val) | 87 | public bool DeleteItems(string field, string val) |
83 | { | 88 | { |
84 | return m_Items.Delete(field, val); | 89 | return m_Items.Delete(field, val); |
85 | } | 90 | } |
86 | 91 | ||
92 | public bool DeleteItems(string[] fields, string[] vals) | ||
93 | { | ||
94 | return m_Items.Delete(fields, vals); | ||
95 | } | ||
96 | |||
87 | public bool MoveItem(string id, string newParent) | 97 | public bool MoveItem(string id, string newParent) |
88 | { | 98 | { |
89 | return m_Items.MoveItem(id, newParent); | 99 | return m_Items.MoveItem(id, newParent); |
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 | } |
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index e14d775..3306968 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Data.MySQL | |||
66 | Initialise(connectionString); | 66 | Initialise(connectionString); |
67 | } | 67 | } |
68 | 68 | ||
69 | public void Initialise(string connectionString) | 69 | public virtual void Initialise(string connectionString) |
70 | { | 70 | { |
71 | m_connectionString = connectionString; | 71 | m_connectionString = connectionString; |
72 | 72 | ||
@@ -130,7 +130,7 @@ namespace OpenSim.Data.MySQL | |||
130 | 130 | ||
131 | public void Dispose() {} | 131 | public void Dispose() {} |
132 | 132 | ||
133 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 133 | public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
134 | { | 134 | { |
135 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | 135 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); |
136 | 136 | ||
@@ -258,7 +258,7 @@ namespace OpenSim.Data.MySQL | |||
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | public void RemoveObject(UUID obj, UUID regionUUID) | 261 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
262 | { | 262 | { |
263 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 263 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
264 | 264 | ||
@@ -407,7 +407,7 @@ namespace OpenSim.Data.MySQL | |||
407 | } | 407 | } |
408 | } | 408 | } |
409 | 409 | ||
410 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 410 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
411 | { | 411 | { |
412 | const int ROWS_PER_QUERY = 5000; | 412 | const int ROWS_PER_QUERY = 5000; |
413 | 413 | ||
@@ -576,7 +576,7 @@ namespace OpenSim.Data.MySQL | |||
576 | } | 576 | } |
577 | } | 577 | } |
578 | 578 | ||
579 | public void StoreTerrain(double[,] ter, UUID regionID) | 579 | public virtual void StoreTerrain(double[,] ter, UUID regionID) |
580 | { | 580 | { |
581 | m_log.Info("[REGION DB]: Storing terrain"); | 581 | m_log.Info("[REGION DB]: Storing terrain"); |
582 | 582 | ||
@@ -605,7 +605,7 @@ namespace OpenSim.Data.MySQL | |||
605 | } | 605 | } |
606 | } | 606 | } |
607 | 607 | ||
608 | public double[,] LoadTerrain(UUID regionID) | 608 | public virtual double[,] LoadTerrain(UUID regionID) |
609 | { | 609 | { |
610 | double[,] terrain = null; | 610 | double[,] terrain = null; |
611 | 611 | ||
@@ -655,7 +655,7 @@ namespace OpenSim.Data.MySQL | |||
655 | return terrain; | 655 | return terrain; |
656 | } | 656 | } |
657 | 657 | ||
658 | public void RemoveLandObject(UUID globalID) | 658 | public virtual void RemoveLandObject(UUID globalID) |
659 | { | 659 | { |
660 | lock (m_dbLock) | 660 | lock (m_dbLock) |
661 | { | 661 | { |
@@ -674,7 +674,7 @@ namespace OpenSim.Data.MySQL | |||
674 | } | 674 | } |
675 | } | 675 | } |
676 | 676 | ||
677 | public void StoreLandObject(ILandObject parcel) | 677 | public virtual void StoreLandObject(ILandObject parcel) |
678 | { | 678 | { |
679 | lock (m_dbLock) | 679 | lock (m_dbLock) |
680 | { | 680 | { |
@@ -731,7 +731,7 @@ namespace OpenSim.Data.MySQL | |||
731 | } | 731 | } |
732 | } | 732 | } |
733 | 733 | ||
734 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 734 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
735 | { | 735 | { |
736 | RegionLightShareData nWP = new RegionLightShareData(); | 736 | RegionLightShareData nWP = new RegionLightShareData(); |
737 | nWP.OnSave += StoreRegionWindlightSettings; | 737 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -828,7 +828,7 @@ namespace OpenSim.Data.MySQL | |||
828 | return nWP; | 828 | return nWP; |
829 | } | 829 | } |
830 | 830 | ||
831 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 831 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
832 | { | 832 | { |
833 | RegionSettings rs = null; | 833 | RegionSettings rs = null; |
834 | 834 | ||
@@ -866,7 +866,7 @@ namespace OpenSim.Data.MySQL | |||
866 | return rs; | 866 | return rs; |
867 | } | 867 | } |
868 | 868 | ||
869 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 869 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
870 | { | 870 | { |
871 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 871 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
872 | { | 872 | { |
@@ -969,7 +969,7 @@ namespace OpenSim.Data.MySQL | |||
969 | } | 969 | } |
970 | } | 970 | } |
971 | 971 | ||
972 | public void RemoveRegionWindlightSettings(UUID regionID) | 972 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
973 | { | 973 | { |
974 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 974 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
975 | { | 975 | { |
@@ -984,7 +984,7 @@ namespace OpenSim.Data.MySQL | |||
984 | } | 984 | } |
985 | } | 985 | } |
986 | 986 | ||
987 | public void StoreRegionSettings(RegionSettings rs) | 987 | public virtual void StoreRegionSettings(RegionSettings rs) |
988 | { | 988 | { |
989 | lock (m_dbLock) | 989 | lock (m_dbLock) |
990 | { | 990 | { |
@@ -1036,7 +1036,7 @@ namespace OpenSim.Data.MySQL | |||
1036 | } | 1036 | } |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1039 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1040 | { | 1040 | { |
1041 | List<LandData> landData = new List<LandData>(); | 1041 | List<LandData> landData = new List<LandData>(); |
1042 | 1042 | ||
@@ -1802,7 +1802,7 @@ namespace OpenSim.Data.MySQL | |||
1802 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 1802 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1803 | } | 1803 | } |
1804 | 1804 | ||
1805 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 1805 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1806 | { | 1806 | { |
1807 | lock (m_dbLock) | 1807 | lock (m_dbLock) |
1808 | { | 1808 | { |
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index 481da49..caf18a4 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs | |||
@@ -85,11 +85,21 @@ namespace OpenSim.Data.MySQL | |||
85 | return m_Folders.Delete(field, val); | 85 | return m_Folders.Delete(field, val); |
86 | } | 86 | } |
87 | 87 | ||
88 | public bool DeleteFolders(string[] fields, string[] vals) | ||
89 | { | ||
90 | return m_Folders.Delete(fields, vals); | ||
91 | } | ||
92 | |||
88 | public bool DeleteItems(string field, string val) | 93 | public bool DeleteItems(string field, string val) |
89 | { | 94 | { |
90 | return m_Items.Delete(field, val); | 95 | return m_Items.Delete(field, val); |
91 | } | 96 | } |
92 | 97 | ||
98 | public bool DeleteItems(string[] fields, string[] vals) | ||
99 | { | ||
100 | return m_Items.Delete(fields, vals); | ||
101 | } | ||
102 | |||
93 | public bool MoveItem(string id, string newParent) | 103 | public bool MoveItem(string id, string newParent) |
94 | { | 104 | { |
95 | return m_Items.MoveItem(id, newParent); | 105 | return m_Items.MoveItem(id, newParent); |
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 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index ccbd86e..02edc30 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs | |||
@@ -91,11 +91,21 @@ namespace OpenSim.Data.SQLite | |||
91 | return m_Folders.Delete(field, val); | 91 | return m_Folders.Delete(field, val); |
92 | } | 92 | } |
93 | 93 | ||
94 | public bool DeleteFolders(string[] fields, string[] vals) | ||
95 | { | ||
96 | return m_Folders.Delete(fields, vals); | ||
97 | } | ||
98 | |||
94 | public bool DeleteItems(string field, string val) | 99 | public bool DeleteItems(string field, string val) |
95 | { | 100 | { |
96 | return m_Items.Delete(field, val); | 101 | return m_Items.Delete(field, val); |
97 | } | 102 | } |
98 | 103 | ||
104 | public bool DeleteItems(string[] fields, string[] vals) | ||
105 | { | ||
106 | return m_Items.Delete(fields, vals); | ||
107 | } | ||
108 | |||
99 | public bool MoveItem(string id, string newParent) | 109 | public bool MoveItem(string id, string newParent) |
100 | { | 110 | { |
101 | return m_Items.MoveItem(id, newParent); | 111 | return m_Items.MoveItem(id, newParent); |