Make the GenericTableHandler work as intended
parent
9972b12812
commit
92be01d5e6
|
@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Data.MySQL
|
namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
public class MySQLGenericTableHandler<T> : MySqlFramework where T: struct
|
public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -63,7 +63,7 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
Type t = typeof(T);
|
Type t = typeof(T);
|
||||||
FieldInfo[] fields = t.GetFields(BindingFlags.NonPublic |
|
FieldInfo[] fields = t.GetFields(BindingFlags.Public |
|
||||||
BindingFlags.Instance |
|
BindingFlags.Instance |
|
||||||
BindingFlags.DeclaredOnly);
|
BindingFlags.DeclaredOnly);
|
||||||
|
|
||||||
|
@ -165,7 +165,11 @@ namespace OpenSim.Data.MySQL
|
||||||
new Dictionary<string, string>();
|
new Dictionary<string, string>();
|
||||||
|
|
||||||
foreach (string col in m_ColumnNames)
|
foreach (string col in m_ColumnNames)
|
||||||
|
{
|
||||||
data[col] = reader[col].ToString();
|
data[col] = reader[col].ToString();
|
||||||
|
if (data[col] == null)
|
||||||
|
data[col] = String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
m_DataField.SetValue(row, data);
|
m_DataField.SetValue(row, data);
|
||||||
}
|
}
|
||||||
|
@ -218,6 +222,8 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values ('" + String.Join("','", values.ToArray()) + "')";
|
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values ('" + String.Join("','", values.ToArray()) + "')";
|
||||||
|
|
||||||
|
cmd.CommandText = query;
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) > 0)
|
if (ExecuteNonQuery(cmd) > 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue