aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 9b8a001..4dfc324 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
37 37
38namespace OpenSim.Data.MySQL 38namespace OpenSim.Data.MySQL
39{ 39{
40 public class MySQLGenericTableHandler<T> : MySqlFramework where T: struct 40 public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
41 { 41 {
42 private static readonly ILog m_log = 42 private static readonly ILog m_log =
43 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -63,7 +63,7 @@ namespace OpenSim.Data.MySQL
63 } 63 }
64 64
65 Type t = typeof(T); 65 Type t = typeof(T);
66 FieldInfo[] fields = t.GetFields(BindingFlags.NonPublic | 66 FieldInfo[] fields = t.GetFields(BindingFlags.Public |
67 BindingFlags.Instance | 67 BindingFlags.Instance |
68 BindingFlags.DeclaredOnly); 68 BindingFlags.DeclaredOnly);
69 69
@@ -165,7 +165,11 @@ namespace OpenSim.Data.MySQL
165 new Dictionary<string, string>(); 165 new Dictionary<string, string>();
166 166
167 foreach (string col in m_ColumnNames) 167 foreach (string col in m_ColumnNames)
168 {
168 data[col] = reader[col].ToString(); 169 data[col] = reader[col].ToString();
170 if (data[col] == null)
171 data[col] = String.Empty;
172 }
169 173
170 m_DataField.SetValue(row, data); 174 m_DataField.SetValue(row, data);
171 } 175 }
@@ -218,6 +222,8 @@ namespace OpenSim.Data.MySQL
218 222
219 query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values ('" + String.Join("','", values.ToArray()) + "')"; 223 query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values ('" + String.Join("','", values.ToArray()) + "')";
220 224
225 cmd.CommandText = query;
226
221 if (ExecuteNonQuery(cmd) > 0) 227 if (ExecuteNonQuery(cmd) > 0)
222 return true; 228 return true;
223 229