diff options
author | Melanie | 2010-05-18 23:02:05 +0100 |
---|---|---|
committer | Melanie | 2010-05-18 23:02:10 +0100 |
commit | 397326ddfa5fd14b8423a152dd9ec5a471924a41 (patch) | |
tree | 8f719ceba221fd7980b7354bb1928ae734c84fc9 | |
parent | Revert "Looks like the new files were never added to prebuild.xml" (diff) | |
parent | Some more corrections after MySQL connector update (diff) | |
download | opensim-SC_OLD-397326ddfa5fd14b8423a152dd9ec5a471924a41.zip opensim-SC_OLD-397326ddfa5fd14b8423a152dd9ec5a471924a41.tar.gz opensim-SC_OLD-397326ddfa5fd14b8423a152dd9ec5a471924a41.tar.bz2 opensim-SC_OLD-397326ddfa5fd14b8423a152dd9ec5a471924a41.tar.xz |
Merge commit 'alex/Migrations'
Another stab at the tests
Signed-off-by: Melanie <melanie@t-data.com>
-rw-r--r-- | OpenSim/Data/DBGuids.cs | 44 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 3 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 24 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | 11 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLInventoryData.cs | 33 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 82 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 10 |
7 files changed, 114 insertions, 93 deletions
diff --git a/OpenSim/Data/DBGuids.cs b/OpenSim/Data/DBGuids.cs new file mode 100644 index 0000000..1a13e06 --- /dev/null +++ b/OpenSim/Data/DBGuids.cs | |||
@@ -0,0 +1,44 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenMetaverse; | ||
5 | |||
6 | namespace OpenSim.Data | ||
7 | { | ||
8 | |||
9 | public static class DBGuid | ||
10 | { | ||
11 | /// <summary>This function converts a value returned from the database in one of the | ||
12 | /// supported formats into a UUID. This function is not actually DBMS-specific right | ||
13 | /// now | ||
14 | /// | ||
15 | /// </summary> | ||
16 | /// <param name="id"></param> | ||
17 | /// <returns></returns> | ||
18 | public static UUID FromDB(object id) | ||
19 | { | ||
20 | if( (id == null) || (id == DBNull.Value)) | ||
21 | return UUID.Zero; | ||
22 | |||
23 | if (id.GetType() == typeof(Guid)) | ||
24 | return new UUID((Guid)id); | ||
25 | |||
26 | if (id.GetType() == typeof(byte[])) | ||
27 | { | ||
28 | if (((byte[])id).Length == 0) | ||
29 | return UUID.Zero; | ||
30 | else if (((byte[])id).Length == 36) | ||
31 | return new UUID((byte[])id, 0); | ||
32 | } | ||
33 | else if (id.GetType() == typeof(string)) | ||
34 | { | ||
35 | if (((string)id).Length == 0) | ||
36 | return UUID.Zero; | ||
37 | else if (((string)id).Length == 36) | ||
38 | return new UUID((string)id); | ||
39 | } | ||
40 | |||
41 | throw new Exception("Failed to convert db value to UUID: " + id.ToString()); | ||
42 | } | ||
43 | } | ||
44 | } | ||
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 13f5fa2..ec18c28 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -33,6 +33,7 @@ using log4net; | |||
33 | using MySql.Data.MySqlClient; | 33 | using MySql.Data.MySqlClient; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Data; | ||
36 | 37 | ||
37 | namespace OpenSim.Data.MySQL | 38 | namespace OpenSim.Data.MySQL |
38 | { | 39 | { |
@@ -320,7 +321,7 @@ namespace OpenSim.Data.MySQL | |||
320 | metadata.Type = (sbyte)dbReader["assetType"]; | 321 | metadata.Type = (sbyte)dbReader["assetType"]; |
321 | metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. | 322 | metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. |
322 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); | 323 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); |
323 | metadata.FullID = new UUID((string)dbReader["id"]); | 324 | metadata.FullID = DBGuid.FromDB(dbReader["id"]); |
324 | 325 | ||
325 | // Current SHA1s are not stored/computed. | 326 | // Current SHA1s are not stored/computed. |
326 | metadata.SHA1 = new byte[] { }; | 327 | metadata.SHA1 = new byte[] { }; |
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 | } |
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs index 1253e0b..6cbb2ee 100644 --- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs +++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs | |||
@@ -148,19 +148,16 @@ namespace OpenSim.Data.MySQL | |||
148 | 148 | ||
149 | foreach (string name in m_Fields.Keys) | 149 | foreach (string name in m_Fields.Keys) |
150 | { | 150 | { |
151 | if (m_Fields[name].GetValue(row) is bool) | 151 | if (m_Fields[name].FieldType == typeof(bool)) |
152 | { | 152 | { |
153 | int v = Convert.ToInt32(reader[name]); | 153 | int v = Convert.ToInt32(reader[name]); |
154 | m_Fields[name].SetValue(row, v != 0 ? true : false); | 154 | m_Fields[name].SetValue(row, v != 0 ? true : false); |
155 | } | 155 | } |
156 | else if (m_Fields[name].GetValue(row) is UUID) | 156 | else if (m_Fields[name].FieldType == typeof(UUID)) |
157 | { | 157 | { |
158 | UUID uuid = UUID.Zero; | 158 | m_Fields[name].SetValue(row, DBGuid.FromDB(reader[name])); |
159 | |||
160 | UUID.TryParse(reader[name].ToString(), out uuid); | ||
161 | m_Fields[name].SetValue(row, uuid); | ||
162 | } | 159 | } |
163 | else if (m_Fields[name].GetValue(row) is int) | 160 | else if (m_Fields[name].FieldType == typeof(int)) |
164 | { | 161 | { |
165 | int v = Convert.ToInt32(reader[name]); | 162 | int v = Convert.ToInt32(reader[name]); |
166 | m_Fields[name].SetValue(row, v); | 163 | m_Fields[name].SetValue(row, v); |
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index e0e9b9c..0aea30f 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -32,6 +32,7 @@ using log4net; | |||
32 | using MySql.Data.MySqlClient; | 32 | using MySql.Data.MySqlClient; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Data; | ||
35 | 36 | ||
36 | namespace OpenSim.Data.MySQL | 37 | namespace OpenSim.Data.MySQL |
37 | { | 38 | { |
@@ -285,31 +286,23 @@ namespace OpenSim.Data.MySQL | |||
285 | InventoryItemBase item = new InventoryItemBase(); | 286 | InventoryItemBase item = new InventoryItemBase(); |
286 | 287 | ||
287 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. | 288 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. |
288 | if (reader["creatorID"] == null) | 289 | // ( DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero ) |
289 | { | 290 | item.CreatorId = reader["creatorID"].ToString(); |
290 | item.CreatorId = UUID.Zero.ToString(); | ||
291 | } | ||
292 | else | ||
293 | { | ||
294 | item.CreatorId = (string)reader["creatorID"]; | ||
295 | } | ||
296 | 291 | ||
297 | // Be a bit safer in parsing these because the | 292 | // Be a bit safer in parsing these because the |
298 | // database doesn't enforce them to be not null, and | 293 | // database doesn't enforce them to be not null, and |
299 | // the inventory still works if these are weird in the | 294 | // the inventory still works if these are weird in the |
300 | // db | 295 | // db |
301 | UUID Owner = UUID.Zero; | 296 | |
302 | UUID GroupID = UUID.Zero; | 297 | // (Empty is Ok, but "weird" will throw!) |
303 | UUID.TryParse((string)reader["avatarID"], out Owner); | 298 | item.Owner = DBGuid.FromDB(reader["avatarID"]); |
304 | UUID.TryParse((string)reader["groupID"], out GroupID); | 299 | item.GroupID = DBGuid.FromDB(reader["groupID"]); |
305 | item.Owner = Owner; | ||
306 | item.GroupID = GroupID; | ||
307 | 300 | ||
308 | // Rest of the parsing. If these UUID's fail, we're dead anyway | 301 | // Rest of the parsing. If these UUID's fail, we're dead anyway |
309 | item.ID = new UUID((string) reader["inventoryID"]); | 302 | item.ID = DBGuid.FromDB(reader["inventoryID"]); |
310 | item.AssetID = new UUID((string) reader["assetID"]); | 303 | item.AssetID = DBGuid.FromDB(reader["assetID"]); |
311 | item.AssetType = (int) reader["assetType"]; | 304 | item.AssetType = (int) reader["assetType"]; |
312 | item.Folder = new UUID((string) reader["parentFolderID"]); | 305 | item.Folder = DBGuid.FromDB(reader["parentFolderID"]); |
313 | item.Name = (string)(reader["inventoryName"] ?? String.Empty); | 306 | item.Name = (string)(reader["inventoryName"] ?? String.Empty); |
314 | item.Description = (string)(reader["inventoryDescription"] ?? String.Empty); | 307 | item.Description = (string)(reader["inventoryDescription"] ?? String.Empty); |
315 | item.NextPermissions = (uint) reader["inventoryNextPermissions"]; | 308 | item.NextPermissions = (uint) reader["inventoryNextPermissions"]; |
@@ -382,9 +375,9 @@ namespace OpenSim.Data.MySQL | |||
382 | try | 375 | try |
383 | { | 376 | { |
384 | InventoryFolderBase folder = new InventoryFolderBase(); | 377 | InventoryFolderBase folder = new InventoryFolderBase(); |
385 | folder.Owner = new UUID((string) reader["agentID"]); | 378 | folder.Owner = DBGuid.FromDB(reader["agentID"]); |
386 | folder.ParentID = new UUID((string) reader["parentFolderID"]); | 379 | folder.ParentID = DBGuid.FromDB(reader["parentFolderID"]); |
387 | folder.ID = new UUID((string) reader["folderID"]); | 380 | folder.ID = DBGuid.FromDB(reader["folderID"]); |
388 | folder.Name = (string) reader["folderName"]; | 381 | folder.Name = (string) reader["folderName"]; |
389 | folder.Type = (short) reader["type"]; | 382 | folder.Type = (short) reader["type"]; |
390 | folder.Version = (ushort) ((int) reader["version"]); | 383 | folder.Version = (ushort) ((int) reader["version"]); |
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index 07371e7..bfeae12 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | |||
@@ -38,6 +38,7 @@ using OpenMetaverse; | |||
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Data; | ||
41 | 42 | ||
42 | namespace OpenSim.Data.MySQL | 43 | namespace OpenSim.Data.MySQL |
43 | { | 44 | { |
@@ -269,7 +270,7 @@ namespace OpenSim.Data.MySQL | |||
269 | using (IDataReader reader = ExecuteReader(cmd)) | 270 | using (IDataReader reader = ExecuteReader(cmd)) |
270 | { | 271 | { |
271 | while (reader.Read()) | 272 | while (reader.Read()) |
272 | uuids.Add(new UUID(reader["UUID"].ToString())); | 273 | uuids.Add(DBGuid.FromDB(reader["UUID"].ToString())); |
273 | } | 274 | } |
274 | 275 | ||
275 | // delete the main prims | 276 | // delete the main prims |
@@ -422,7 +423,7 @@ namespace OpenSim.Data.MySQL | |||
422 | else | 423 | else |
423 | prim.Shape = BuildShape(reader); | 424 | prim.Shape = BuildShape(reader); |
424 | 425 | ||
425 | UUID parentID = new UUID(reader["SceneGroupID"].ToString()); | 426 | UUID parentID = DBGuid.FromDB(reader["SceneGroupID"].ToString()); |
426 | if (parentID != prim.UUID) | 427 | if (parentID != prim.UUID) |
427 | prim.ParentUUID = parentID; | 428 | prim.ParentUUID = parentID; |
428 | 429 | ||
@@ -500,7 +501,7 @@ namespace OpenSim.Data.MySQL | |||
500 | { | 501 | { |
501 | if (!(itemReader["primID"] is DBNull)) | 502 | if (!(itemReader["primID"] is DBNull)) |
502 | { | 503 | { |
503 | UUID primID = new UUID(itemReader["primID"].ToString()); | 504 | UUID primID = DBGuid.FromDB(itemReader["primID"].ToString()); |
504 | if (prims.ContainsKey(primID)) | 505 | if (prims.ContainsKey(primID)) |
505 | primsWithInventory.Add(prims[primID]); | 506 | primsWithInventory.Add(prims[primID]); |
506 | } | 507 | } |
@@ -738,7 +739,7 @@ namespace OpenSim.Data.MySQL | |||
738 | } | 739 | } |
739 | else | 740 | else |
740 | { | 741 | { |
741 | UUID.TryParse(result["region_id"].ToString(), out nWP.regionID); | 742 | nWP.regionID = DBGuid.FromDB(result["region_id"]); |
742 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); | 743 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); |
743 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); | 744 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); |
744 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); | 745 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); |
@@ -1055,7 +1056,14 @@ namespace OpenSim.Data.MySQL | |||
1055 | private SceneObjectPart BuildPrim(IDataReader row) | 1056 | private SceneObjectPart BuildPrim(IDataReader row) |
1056 | { | 1057 | { |
1057 | SceneObjectPart prim = new SceneObjectPart(); | 1058 | SceneObjectPart prim = new SceneObjectPart(); |
1058 | prim.UUID = new UUID((string)row["UUID"]); | 1059 | |
1060 | // depending on the MySQL connector version, CHAR(36) may be already converted to Guid! | ||
1061 | prim.UUID = DBGuid.FromDB(row["UUID"]); | ||
1062 | prim.CreatorID = DBGuid.FromDB(row["CreatorID"]); | ||
1063 | prim.OwnerID = DBGuid.FromDB(row["OwnerID"]); | ||
1064 | prim.GroupID = DBGuid.FromDB(row["GroupID"]); | ||
1065 | prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]); | ||
1066 | |||
1059 | // explicit conversion of integers is required, which sort | 1067 | // explicit conversion of integers is required, which sort |
1060 | // of sucks. No idea if there is a shortcut here or not. | 1068 | // of sucks. No idea if there is a shortcut here or not. |
1061 | prim.CreationDate = (int)row["CreationDate"]; | 1069 | prim.CreationDate = (int)row["CreationDate"]; |
@@ -1074,15 +1082,12 @@ namespace OpenSim.Data.MySQL | |||
1074 | prim.TouchName = (string)row["TouchName"]; | 1082 | prim.TouchName = (string)row["TouchName"]; |
1075 | // Permissions | 1083 | // Permissions |
1076 | prim.ObjectFlags = (uint)(int)row["ObjectFlags"]; | 1084 | prim.ObjectFlags = (uint)(int)row["ObjectFlags"]; |
1077 | prim.CreatorID = new UUID((string)row["CreatorID"]); | ||
1078 | prim.OwnerID = new UUID((string)row["OwnerID"]); | ||
1079 | prim.GroupID = new UUID((string)row["GroupID"]); | ||
1080 | prim.LastOwnerID = new UUID((string)row["LastOwnerID"]); | ||
1081 | prim.OwnerMask = (uint)(int)row["OwnerMask"]; | 1085 | prim.OwnerMask = (uint)(int)row["OwnerMask"]; |
1082 | prim.NextOwnerMask = (uint)(int)row["NextOwnerMask"]; | 1086 | prim.NextOwnerMask = (uint)(int)row["NextOwnerMask"]; |
1083 | prim.GroupMask = (uint)(int)row["GroupMask"]; | 1087 | prim.GroupMask = (uint)(int)row["GroupMask"]; |
1084 | prim.EveryoneMask = (uint)(int)row["EveryoneMask"]; | 1088 | prim.EveryoneMask = (uint)(int)row["EveryoneMask"]; |
1085 | prim.BaseMask = (uint)(int)row["BaseMask"]; | 1089 | prim.BaseMask = (uint)(int)row["BaseMask"]; |
1090 | |||
1086 | // Vectors | 1091 | // Vectors |
1087 | prim.OffsetPosition = new Vector3( | 1092 | prim.OffsetPosition = new Vector3( |
1088 | (float)(double)row["PositionX"], | 1093 | (float)(double)row["PositionX"], |
@@ -1134,7 +1139,7 @@ namespace OpenSim.Data.MySQL | |||
1134 | prim.PayPrice[3] = (int)row["PayButton3"]; | 1139 | prim.PayPrice[3] = (int)row["PayButton3"]; |
1135 | prim.PayPrice[4] = (int)row["PayButton4"]; | 1140 | prim.PayPrice[4] = (int)row["PayButton4"]; |
1136 | 1141 | ||
1137 | prim.Sound = new UUID(row["LoopedSound"].ToString()); | 1142 | prim.Sound = DBGuid.FromDB(row["LoopedSound"].ToString()); |
1138 | prim.SoundGain = (float)(double)row["LoopedSoundGain"]; | 1143 | prim.SoundGain = (float)(double)row["LoopedSoundGain"]; |
1139 | prim.SoundFlags = 1; // If it's persisted at all, it's looped | 1144 | prim.SoundFlags = 1; // If it's persisted at all, it's looped |
1140 | 1145 | ||
@@ -1161,16 +1166,10 @@ namespace OpenSim.Data.MySQL | |||
1161 | (float)(double)row["CameraAtOffsetZ"] | 1166 | (float)(double)row["CameraAtOffsetZ"] |
1162 | )); | 1167 | )); |
1163 | 1168 | ||
1164 | if ((sbyte)row["ForceMouselook"] != 0) | 1169 | prim.SetForceMouselook((sbyte)row["ForceMouselook"] != 0); |
1165 | prim.SetForceMouselook(true); | ||
1166 | |||
1167 | prim.ScriptAccessPin = (int)row["ScriptAccessPin"]; | 1170 | prim.ScriptAccessPin = (int)row["ScriptAccessPin"]; |
1168 | 1171 | prim.AllowedDrop = ((sbyte)row["AllowedDrop"] != 0); | |
1169 | if ((sbyte)row["AllowedDrop"] != 0) | 1172 | prim.DIE_AT_EDGE = ((sbyte)row["DieAtEdge"] != 0); |
1170 | prim.AllowedDrop = true; | ||
1171 | |||
1172 | if ((sbyte)row["DieAtEdge"] != 0) | ||
1173 | prim.DIE_AT_EDGE = true; | ||
1174 | 1173 | ||
1175 | prim.SalePrice = (int)row["SalePrice"]; | 1174 | prim.SalePrice = (int)row["SalePrice"]; |
1176 | prim.ObjectSaleType = unchecked((byte)(sbyte)row["SaleType"]); | 1175 | prim.ObjectSaleType = unchecked((byte)(sbyte)row["SaleType"]); |
@@ -1180,11 +1179,10 @@ namespace OpenSim.Data.MySQL | |||
1180 | if (!(row["ClickAction"] is DBNull)) | 1179 | if (!(row["ClickAction"] is DBNull)) |
1181 | prim.ClickAction = unchecked((byte)(sbyte)row["ClickAction"]); | 1180 | prim.ClickAction = unchecked((byte)(sbyte)row["ClickAction"]); |
1182 | 1181 | ||
1183 | prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); | 1182 | prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]); |
1184 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; | 1183 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; |
1185 | 1184 | ||
1186 | if ((sbyte)row["PassTouches"] != 0) | 1185 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); |
1187 | prim.PassTouches = true; | ||
1188 | prim.LinkNum = (int)row["LinkNumber"]; | 1186 | prim.LinkNum = (int)row["LinkNumber"]; |
1189 | 1187 | ||
1190 | return prim; | 1188 | return prim; |
@@ -1200,10 +1198,10 @@ namespace OpenSim.Data.MySQL | |||
1200 | { | 1198 | { |
1201 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1199 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1202 | 1200 | ||
1203 | taskItem.ItemID = new UUID((String)row["itemID"]); | 1201 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1204 | taskItem.ParentPartID = new UUID((String)row["primID"]); | 1202 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1205 | taskItem.AssetID = new UUID((String)row["assetID"]); | 1203 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); |
1206 | taskItem.ParentID = new UUID((String)row["parentFolderID"]); | 1204 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1207 | 1205 | ||
1208 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1206 | taskItem.InvType = Convert.ToInt32(row["invType"]); |
1209 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1207 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
@@ -1211,10 +1209,10 @@ namespace OpenSim.Data.MySQL | |||
1211 | taskItem.Name = (String)row["name"]; | 1209 | taskItem.Name = (String)row["name"]; |
1212 | taskItem.Description = (String)row["description"]; | 1210 | taskItem.Description = (String)row["description"]; |
1213 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1211 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1214 | taskItem.CreatorID = new UUID((String)row["creatorID"]); | 1212 | taskItem.CreatorID = DBGuid.FromDB(row["creatorID"]); |
1215 | taskItem.OwnerID = new UUID((String)row["ownerID"]); | 1213 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1216 | taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]); | 1214 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); |
1217 | taskItem.GroupID = new UUID((String)row["groupID"]); | 1215 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1218 | 1216 | ||
1219 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1217 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1220 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1218 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
@@ -1230,7 +1228,7 @@ namespace OpenSim.Data.MySQL | |||
1230 | { | 1228 | { |
1231 | RegionSettings newSettings = new RegionSettings(); | 1229 | RegionSettings newSettings = new RegionSettings(); |
1232 | 1230 | ||
1233 | newSettings.RegionUUID = new UUID((string) row["regionUUID"]); | 1231 | newSettings.RegionUUID = DBGuid.FromDB(row["regionUUID"]); |
1234 | newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); | 1232 | newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); |
1235 | newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); | 1233 | newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); |
1236 | newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); | 1234 | newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); |
@@ -1244,10 +1242,10 @@ namespace OpenSim.Data.MySQL | |||
1244 | newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); | 1242 | newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); |
1245 | newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); | 1243 | newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); |
1246 | newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); | 1244 | newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); |
1247 | newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]); | 1245 | newSettings.TerrainTexture1 = DBGuid.FromDB(row["terrain_texture_1"]); |
1248 | newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]); | 1246 | newSettings.TerrainTexture2 = DBGuid.FromDB(row["terrain_texture_2"]); |
1249 | newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]); | 1247 | newSettings.TerrainTexture3 = DBGuid.FromDB(row["terrain_texture_3"]); |
1250 | newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]); | 1248 | newSettings.TerrainTexture4 = DBGuid.FromDB(row["terrain_texture_4"]); |
1251 | newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); | 1249 | newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); |
1252 | newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); | 1250 | newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); |
1253 | newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); | 1251 | newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); |
@@ -1268,7 +1266,7 @@ namespace OpenSim.Data.MySQL | |||
1268 | ); | 1266 | ); |
1269 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); | 1267 | newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); |
1270 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); | 1268 | newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); |
1271 | newSettings.Covenant = new UUID((String) row["covenant"]); | 1269 | newSettings.Covenant = DBGuid.FromDB(row["covenant"]); |
1272 | 1270 | ||
1273 | newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); | 1271 | newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); |
1274 | 1272 | ||
@@ -1277,7 +1275,7 @@ namespace OpenSim.Data.MySQL | |||
1277 | else | 1275 | else |
1278 | newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; | 1276 | newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; |
1279 | 1277 | ||
1280 | newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); | 1278 | newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); |
1281 | 1279 | ||
1282 | return newSettings; | 1280 | return newSettings; |
1283 | } | 1281 | } |
@@ -1291,7 +1289,7 @@ namespace OpenSim.Data.MySQL | |||
1291 | { | 1289 | { |
1292 | LandData newData = new LandData(); | 1290 | LandData newData = new LandData(); |
1293 | 1291 | ||
1294 | newData.GlobalID = new UUID((String) row["UUID"]); | 1292 | newData.GlobalID = DBGuid.FromDB(row["UUID"]); |
1295 | newData.LocalID = Convert.ToInt32(row["LocalLandID"]); | 1293 | newData.LocalID = Convert.ToInt32(row["LocalLandID"]); |
1296 | 1294 | ||
1297 | // Bitmap is a byte[512] | 1295 | // Bitmap is a byte[512] |
@@ -1299,7 +1297,7 @@ namespace OpenSim.Data.MySQL | |||
1299 | 1297 | ||
1300 | newData.Name = (String) row["Name"]; | 1298 | newData.Name = (String) row["Name"]; |
1301 | newData.Description = (String) row["Description"]; | 1299 | newData.Description = (String) row["Description"]; |
1302 | newData.OwnerID = new UUID((String)row["OwnerUUID"]); | 1300 | newData.OwnerID = DBGuid.FromDB(row["OwnerUUID"]); |
1303 | newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); | 1301 | newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); |
1304 | newData.Area = Convert.ToInt32(row["Area"]); | 1302 | newData.Area = Convert.ToInt32(row["Area"]); |
1305 | newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unimplemented | 1303 | newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unimplemented |
@@ -1307,14 +1305,14 @@ namespace OpenSim.Data.MySQL | |||
1307 | //Enum libsecondlife.Parcel.ParcelCategory | 1305 | //Enum libsecondlife.Parcel.ParcelCategory |
1308 | newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); | 1306 | newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); |
1309 | newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); | 1307 | newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); |
1310 | newData.GroupID = new UUID((String) row["GroupUUID"]); | 1308 | newData.GroupID = DBGuid.FromDB(row["GroupUUID"]); |
1311 | newData.SalePrice = Convert.ToInt32(row["SalePrice"]); | 1309 | newData.SalePrice = Convert.ToInt32(row["SalePrice"]); |
1312 | newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]); | 1310 | newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]); |
1313 | //Enum. libsecondlife.Parcel.ParcelStatus | 1311 | //Enum. libsecondlife.Parcel.ParcelStatus |
1314 | newData.Flags = Convert.ToUInt32(row["LandFlags"]); | 1312 | newData.Flags = Convert.ToUInt32(row["LandFlags"]); |
1315 | newData.LandingType = Convert.ToByte(row["LandingType"]); | 1313 | newData.LandingType = Convert.ToByte(row["LandingType"]); |
1316 | newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); | 1314 | newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); |
1317 | newData.MediaID = new UUID((String) row["MediaTextureUUID"]); | 1315 | newData.MediaID = DBGuid.FromDB(row["MediaTextureUUID"]); |
1318 | newData.MediaURL = (String) row["MediaURL"]; | 1316 | newData.MediaURL = (String) row["MediaURL"]; |
1319 | newData.MusicURL = (String) row["MusicURL"]; | 1317 | newData.MusicURL = (String) row["MusicURL"]; |
1320 | newData.PassHours = Convert.ToSingle(row["PassHours"]); | 1318 | newData.PassHours = Convert.ToSingle(row["PassHours"]); |
@@ -1358,7 +1356,7 @@ namespace OpenSim.Data.MySQL | |||
1358 | private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataReader row) | 1356 | private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataReader row) |
1359 | { | 1357 | { |
1360 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 1358 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
1361 | entry.AgentID = new UUID((string) row["AccessUUID"]); | 1359 | entry.AgentID = DBGuid.FromDB(row["AccessUUID"]); |
1362 | entry.Flags = (AccessList) Convert.ToInt32(row["Flags"]); | 1360 | entry.Flags = (AccessList) Convert.ToInt32(row["Flags"]); |
1363 | entry.Time = new DateTime(); | 1361 | entry.Time = new DateTime(); |
1364 | return entry; | 1362 | return entry; |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index aa9a104..c7bddac 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Data; | 31 | using System.Data; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Data; | ||
34 | using MySql.Data.MySqlClient; | 35 | using MySql.Data.MySqlClient; |
35 | 36 | ||
36 | namespace OpenSim.Data.MySQL | 37 | namespace OpenSim.Data.MySQL |
@@ -143,12 +144,9 @@ namespace OpenSim.Data.MySQL | |||
143 | RegionData ret = new RegionData(); | 144 | RegionData ret = new RegionData(); |
144 | ret.Data = new Dictionary<string, object>(); | 145 | ret.Data = new Dictionary<string, object>(); |
145 | 146 | ||
146 | UUID regionID; | 147 | ret.RegionID = DBGuid.FromDB(result["uuid"]); |
147 | UUID.TryParse(result["uuid"].ToString(), out regionID); | 148 | ret.ScopeID = DBGuid.FromDB(result["ScopeID"]); |
148 | ret.RegionID = regionID; | 149 | |
149 | UUID scope; | ||
150 | UUID.TryParse(result["ScopeID"].ToString(), out scope); | ||
151 | ret.ScopeID = scope; | ||
152 | ret.RegionName = result["regionName"].ToString(); | 150 | ret.RegionName = result["regionName"].ToString(); |
153 | ret.posX = Convert.ToInt32(result["locX"]); | 151 | ret.posX = Convert.ToInt32(result["locX"]); |
154 | ret.posY = Convert.ToInt32(result["locY"]); | 152 | ret.posY = Convert.ToInt32(result["locY"]); |