diff options
author | AlexRa | 2010-05-18 14:28:12 +0300 |
---|---|---|
committer | AlexRa | 2010-05-19 01:33:02 +0300 |
commit | 8a0c5d14d45571c3e7529fdacea6f0483af482e5 (patch) | |
tree | 30b580dbda83e3b8e3966fa7d538d5aee8102a63 /OpenSim/Data/MySQL/MySQLEstateData.cs | |
parent | Added DBGuids.cs (static func DBGuid.FromDB() (diff) | |
download | opensim-SC-8a0c5d14d45571c3e7529fdacea6f0483af482e5.zip opensim-SC-8a0c5d14d45571c3e7529fdacea6f0483af482e5.tar.gz opensim-SC-8a0c5d14d45571c3e7529fdacea6f0483af482e5.tar.bz2 opensim-SC-8a0c5d14d45571c3e7529fdacea6f0483af482e5.tar.xz |
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)
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLEstateData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 24 |
1 files changed, 7 insertions, 17 deletions
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; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Data; | ||
37 | 38 | ||
38 | namespace OpenSim.Data.MySQL | 39 | namespace OpenSim.Data.MySQL |
39 | { | 40 | { |
@@ -156,20 +157,13 @@ namespace OpenSim.Data.MySQL | |||
156 | 157 | ||
157 | foreach (string name in FieldList) | 158 | foreach (string name in FieldList) |
158 | { | 159 | { |
159 | if (m_FieldMap[name].GetValue(es) is bool) | 160 | if (m_FieldMap[name].FieldType == typeof(bool)) |
160 | { | 161 | { |
161 | int v = Convert.ToInt32(r[name]); | 162 | m_FieldMap[name].SetValue(es, Convert.ToInt32(r[name]) != 0); |
162 | if (v != 0) | ||
163 | m_FieldMap[name].SetValue(es, true); | ||
164 | else | ||
165 | m_FieldMap[name].SetValue(es, false); | ||
166 | } | 163 | } |
167 | else if (m_FieldMap[name].GetValue(es) is UUID) | 164 | else if (m_FieldMap[name].FieldType == typeof(UUID)) |
168 | { | 165 | { |
169 | UUID uuid = UUID.Zero; | 166 | m_FieldMap[name].SetValue(es, DBGuid.FromDB(r[name])); |
170 | |||
171 | UUID.TryParse(r[name].ToString(), out uuid); | ||
172 | m_FieldMap[name].SetValue(es, uuid); | ||
173 | } | 167 | } |
174 | else | 168 | else |
175 | { | 169 | { |
@@ -385,11 +379,7 @@ namespace OpenSim.Data.MySQL | |||
385 | while (r.Read()) | 379 | while (r.Read()) |
386 | { | 380 | { |
387 | // EstateBan eb = new EstateBan(); | 381 | // EstateBan eb = new EstateBan(); |
388 | 382 | uuids.Add(DBGuid.FromDB(r["uuid"])); | |
389 | UUID uuid = new UUID(); | ||
390 | UUID.TryParse(r["uuid"].ToString(), out uuid); | ||
391 | |||
392 | uuids.Add(uuid); | ||
393 | } | 383 | } |
394 | } | 384 | } |
395 | } | 385 | } |
@@ -490,7 +480,7 @@ namespace OpenSim.Data.MySQL | |||
490 | using (IDataReader reader = cmd.ExecuteReader()) | 480 | using (IDataReader reader = cmd.ExecuteReader()) |
491 | { | 481 | { |
492 | while(reader.Read()) | 482 | while(reader.Read()) |
493 | result.Add(new UUID(reader["RegionID"].ToString())); | 483 | result.Add(DBGuid.FromDB(reader["RegionID"])); |
494 | reader.Close(); | 484 | reader.Close(); |
495 | } | 485 | } |
496 | } | 486 | } |