diff options
author | Melanie | 2009-11-18 08:53:07 +0000 |
---|---|---|
committer | Melanie | 2009-11-18 08:53:07 +0000 |
commit | 23438e66e7ee3cd71652cdf6fd6a801544179ec0 (patch) | |
tree | e465b49a60cecdad24b825b00f40c894e8afaead /OpenSim/Data | |
parent | Tweak presence handling and whip up a database connector and handler (diff) | |
download | opensim-SC-23438e66e7ee3cd71652cdf6fd6a801544179ec0.zip opensim-SC-23438e66e7ee3cd71652cdf6fd6a801544179ec0.tar.gz opensim-SC-23438e66e7ee3cd71652cdf6fd6a801544179ec0.tar.bz2 opensim-SC-23438e66e7ee3cd71652cdf6fd6a801544179ec0.tar.xz |
Implement generic delete method
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/IPresenceData.cs | 3 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 15 |
2 files changed, 16 insertions, 2 deletions
diff --git a/OpenSim/Data/IPresenceData.cs b/OpenSim/Data/IPresenceData.cs index 020ba5d..e5a8ebd 100644 --- a/OpenSim/Data/IPresenceData.cs +++ b/OpenSim/Data/IPresenceData.cs | |||
@@ -48,7 +48,8 @@ namespace OpenSim.Data | |||
48 | 48 | ||
49 | PresenceData Get(UUID principalID); | 49 | PresenceData Get(UUID principalID); |
50 | 50 | ||
51 | bool SetDataItem(UUID principalID, string item, string value); | 51 | bool SetUserDataItem(UUID principalID, string item, string value); |
52 | bool SetRegionDataItem(UUID principalID, string item, string value); | ||
52 | 53 | ||
53 | bool Delete(UUID regionID); | 54 | bool Delete(UUID regionID); |
54 | } | 55 | } |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 1521dc7..4e27e26 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -112,7 +112,7 @@ namespace OpenSim.Data.MySQL | |||
112 | for (int i = 0 ; i < fields.Length ; i++) | 112 | for (int i = 0 ; i < fields.Length ; i++) |
113 | { | 113 | { |
114 | cmd.Parameters.AddWithValue(fields[i], keys[i]); | 114 | cmd.Parameters.AddWithValue(fields[i], keys[i]); |
115 | terms.Add(fields[i] + " = ?" + fields[i]); | 115 | terms.Add("`" + fields[i] + "` = ?" + fields[i]); |
116 | } | 116 | } |
117 | 117 | ||
118 | string where = String.Join(" and ", terms.ToArray()); | 118 | string where = String.Join(" and ", terms.ToArray()); |
@@ -198,5 +198,18 @@ namespace OpenSim.Data.MySQL | |||
198 | 198 | ||
199 | return false; | 199 | return false; |
200 | } | 200 | } |
201 | |||
202 | public bool Delete(string field, string val) | ||
203 | { | ||
204 | MySqlCommand cmd = new MySqlCommand(); | ||
205 | |||
206 | cmd.CommandText = String.Format("delete from {0} where `{1}` = ?{1}", m_Realm, field); | ||
207 | cmd.Parameters.AddWithValue(field, val); | ||
208 | |||
209 | if (ExecuteNonQuery(cmd) > 0) | ||
210 | return true; | ||
211 | |||
212 | return false; | ||
213 | } | ||
201 | } | 214 | } |
202 | } | 215 | } |