aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
diff options
context:
space:
mode:
authorAlexRa2010-05-18 14:28:12 +0300
committerAlexRa2010-05-19 01:33:02 +0300
commit8a0c5d14d45571c3e7529fdacea6f0483af482e5 (patch)
tree30b580dbda83e3b8e3966fa7d538d5aee8102a63 /OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
parentAdded DBGuids.cs (static func DBGuid.FromDB() (diff)
downloadopensim-SC_OLD-8a0c5d14d45571c3e7529fdacea6f0483af482e5.zip
opensim-SC_OLD-8a0c5d14d45571c3e7529fdacea6f0483af482e5.tar.gz
opensim-SC_OLD-8a0c5d14d45571c3e7529fdacea6f0483af482e5.tar.bz2
opensim-SC_OLD-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/MySQLLegacyRegionData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs82
1 files changed, 40 insertions, 42 deletions
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;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Data;
41 42
42namespace OpenSim.Data.MySQL 43namespace 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;