aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
diff options
context:
space:
mode:
authorMelanie2009-12-26 00:19:54 +0000
committerMelanie2009-12-26 00:19:54 +0000
commit9972b12812d343c48843057ddb2f4ea9c7f96bb4 (patch)
treef1f742e1a6d96ad0bf32614df015137c49a30273 /OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-9972b12812d343c48843057ddb2f4ea9c7f96bb4.zip
opensim-SC_OLD-9972b12812d343c48843057ddb2f4ea9c7f96bb4.tar.gz
opensim-SC_OLD-9972b12812d343c48843057ddb2f4ea9c7f96bb4.tar.bz2
opensim-SC_OLD-9972b12812d343c48843057ddb2f4ea9c7f96bb4.tar.xz
Add a generic REPLACE INTO handler for put into the generic table handler
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 2f5937d..9b8a001 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -195,6 +195,31 @@ namespace OpenSim.Data.MySQL
195 MySqlCommand cmd = new MySqlCommand(); 195 MySqlCommand cmd = new MySqlCommand();
196 196
197 string query = ""; 197 string query = "";
198 List<String> names = new List<String>();
199 List<String> values = new List<String>();
200
201 foreach (FieldInfo fi in m_Fields.Values)
202 {
203 names.Add(fi.Name);
204 values.Add(fi.GetValue(row).ToString());
205 }
206
207 if (m_DataField != null)
208 {
209 Dictionary<string, string> data =
210 (Dictionary<string, string>)m_DataField.GetValue(row);
211
212 foreach (KeyValuePair<string, string> kvp in data)
213 {
214 names.Add(kvp.Key);
215 values.Add(kvp.Value);
216 }
217 }
218
219 query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values ('" + String.Join("','", values.ToArray()) + "')";
220
221 if (ExecuteNonQuery(cmd) > 0)
222 return true;
198 223
199 return false; 224 return false;
200 } 225 }