From 8a0c5d14d45571c3e7529fdacea6f0483af482e5 Mon Sep 17 00:00:00 2001 From: AlexRa Date: Tue, 18 May 2010 14:28:12 +0300 Subject: All (?) MySQL stores fixed to use DBGuid.FromDB() This was needed if we want to update to the latest MySQL connector dll. It automatically converts CHAR(36) to Guids, so getting them as strings no longer works. By using DBGuid.FromDB(), we unlink from any particular storage format of GUIDs, could even make them BINARY(16) if we like. Actually not all MySql units are touched, but the remaining ones don't seem to be affected (they don't read GUIDs from DB) --- OpenSim/Data/MySQL/MySQLEstateData.cs | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'OpenSim/Data/MySQL/MySQLEstateData.cs') diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 08e2144..9158f7a 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs @@ -34,6 +34,7 @@ using MySql.Data.MySqlClient; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; +using OpenSim.Data; namespace OpenSim.Data.MySQL { @@ -156,20 +157,13 @@ namespace OpenSim.Data.MySQL foreach (string name in FieldList) { - if (m_FieldMap[name].GetValue(es) is bool) + if (m_FieldMap[name].FieldType == typeof(bool)) { - int v = Convert.ToInt32(r[name]); - if (v != 0) - m_FieldMap[name].SetValue(es, true); - else - m_FieldMap[name].SetValue(es, false); + m_FieldMap[name].SetValue(es, Convert.ToInt32(r[name]) != 0); } - else if (m_FieldMap[name].GetValue(es) is UUID) + else if (m_FieldMap[name].FieldType == typeof(UUID)) { - UUID uuid = UUID.Zero; - - UUID.TryParse(r[name].ToString(), out uuid); - m_FieldMap[name].SetValue(es, uuid); + m_FieldMap[name].SetValue(es, DBGuid.FromDB(r[name])); } else { @@ -385,11 +379,7 @@ namespace OpenSim.Data.MySQL while (r.Read()) { // EstateBan eb = new EstateBan(); - - UUID uuid = new UUID(); - UUID.TryParse(r["uuid"].ToString(), out uuid); - - uuids.Add(uuid); + uuids.Add(DBGuid.FromDB(r["uuid"])); } } } @@ -490,7 +480,7 @@ namespace OpenSim.Data.MySQL using (IDataReader reader = cmd.ExecuteReader()) { while(reader.Read()) - result.Add(new UUID(reader["RegionID"].ToString())); + result.Add(DBGuid.FromDB(reader["RegionID"])); reader.Close(); } } -- cgit v1.1