diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 274 |
1 files changed, 201 insertions, 73 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index d562783..01b9299 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Data.MySQL | |||
66 | Initialise(connectionString); | 66 | Initialise(connectionString); |
67 | } | 67 | } |
68 | 68 | ||
69 | public void Initialise(string connectionString) | 69 | public virtual void Initialise(string connectionString) |
70 | { | 70 | { |
71 | m_connectionString = connectionString; | 71 | m_connectionString = connectionString; |
72 | 72 | ||
@@ -113,14 +113,16 @@ namespace OpenSim.Data.MySQL | |||
113 | 113 | ||
114 | public void Dispose() {} | 114 | public void Dispose() {} |
115 | 115 | ||
116 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 116 | public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
117 | { | 117 | { |
118 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | 118 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); |
119 | 119 | ||
120 | // Eligibility check | 120 | // Eligibility check |
121 | // | 121 | // |
122 | if ((flags & (uint)PrimFlags.Temporary) != 0) | 122 | // PrimFlags.Temporary is not used in OpenSim code and cannot |
123 | return; | 123 | // be guaranteed to always be clear. Don't check it. |
124 | // if ((flags & (uint)PrimFlags.Temporary) != 0) | ||
125 | // return; | ||
124 | if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) | 126 | if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) |
125 | return; | 127 | return; |
126 | 128 | ||
@@ -135,7 +137,7 @@ namespace OpenSim.Data.MySQL | |||
135 | foreach (SceneObjectPart prim in obj.Parts) | 137 | foreach (SceneObjectPart prim in obj.Parts) |
136 | { | 138 | { |
137 | cmd.Parameters.Clear(); | 139 | cmd.Parameters.Clear(); |
138 | 140 | ||
139 | cmd.CommandText = "replace into prims (" + | 141 | cmd.CommandText = "replace into prims (" + |
140 | "UUID, CreationDate, " + | 142 | "UUID, CreationDate, " + |
141 | "Name, Text, Description, " + | 143 | "Name, Text, Description, " + |
@@ -171,7 +173,11 @@ namespace OpenSim.Data.MySQL | |||
171 | "ParticleSystem, ClickAction, Material, " + | 173 | "ParticleSystem, ClickAction, Material, " + |
172 | "CollisionSound, CollisionSoundVolume, " + | 174 | "CollisionSound, CollisionSoundVolume, " + |
173 | "PassTouches, " + | 175 | "PassTouches, " + |
174 | "LinkNumber, MediaURL) values (" + "?UUID, " + | 176 | "PassCollisions, " + |
177 | "LinkNumber, MediaURL, KeyframeMotion, " + | ||
178 | "PhysicsShapeType, Density, GravityModifier, " + | ||
179 | "Friction, Restitution, Vehicle " + | ||
180 | ") values (" + "?UUID, " + | ||
175 | "?CreationDate, ?Name, ?Text, " + | 181 | "?CreationDate, ?Name, ?Text, " + |
176 | "?Description, ?SitName, ?TouchName, " + | 182 | "?Description, ?SitName, ?TouchName, " + |
177 | "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + | 183 | "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + |
@@ -202,14 +208,17 @@ namespace OpenSim.Data.MySQL | |||
202 | "?SaleType, ?ColorR, ?ColorG, " + | 208 | "?SaleType, ?ColorR, ?ColorG, " + |
203 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 209 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
204 | "?ClickAction, ?Material, ?CollisionSound, " + | 210 | "?ClickAction, ?Material, ?CollisionSound, " + |
205 | "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; | 211 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
206 | 212 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + | |
213 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | ||
214 | "?Friction, ?Restitution, ?Vehicle)"; | ||
215 | |||
207 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 216 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
208 | 217 | ||
209 | ExecuteNonQuery(cmd); | 218 | ExecuteNonQuery(cmd); |
210 | 219 | ||
211 | cmd.Parameters.Clear(); | 220 | cmd.Parameters.Clear(); |
212 | 221 | ||
213 | cmd.CommandText = "replace into primshapes (" + | 222 | cmd.CommandText = "replace into primshapes (" + |
214 | "UUID, Shape, ScaleX, ScaleY, " + | 223 | "UUID, Shape, ScaleX, ScaleY, " + |
215 | "ScaleZ, PCode, PathBegin, PathEnd, " + | 224 | "ScaleZ, PCode, PathBegin, PathEnd, " + |
@@ -231,9 +240,9 @@ namespace OpenSim.Data.MySQL | |||
231 | "?ProfileEnd, ?ProfileCurve, " + | 240 | "?ProfileEnd, ?ProfileCurve, " + |
232 | "?ProfileHollow, ?Texture, ?ExtraParams, " + | 241 | "?ProfileHollow, ?Texture, ?ExtraParams, " + |
233 | "?State, ?Media)"; | 242 | "?State, ?Media)"; |
234 | 243 | ||
235 | FillShapeCommand(cmd, prim); | 244 | FillShapeCommand(cmd, prim); |
236 | 245 | ||
237 | ExecuteNonQuery(cmd); | 246 | ExecuteNonQuery(cmd); |
238 | } | 247 | } |
239 | } | 248 | } |
@@ -241,7 +250,7 @@ namespace OpenSim.Data.MySQL | |||
241 | } | 250 | } |
242 | } | 251 | } |
243 | 252 | ||
244 | public void RemoveObject(UUID obj, UUID regionUUID) | 253 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
245 | { | 254 | { |
246 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 255 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
247 | 256 | ||
@@ -390,7 +399,7 @@ namespace OpenSim.Data.MySQL | |||
390 | } | 399 | } |
391 | } | 400 | } |
392 | 401 | ||
393 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 402 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
394 | { | 403 | { |
395 | const int ROWS_PER_QUERY = 5000; | 404 | const int ROWS_PER_QUERY = 5000; |
396 | 405 | ||
@@ -446,7 +455,11 @@ namespace OpenSim.Data.MySQL | |||
446 | foreach (SceneObjectPart prim in prims.Values) | 455 | foreach (SceneObjectPart prim in prims.Values) |
447 | { | 456 | { |
448 | if (prim.ParentUUID == UUID.Zero) | 457 | if (prim.ParentUUID == UUID.Zero) |
458 | { | ||
449 | objects[prim.UUID] = new SceneObjectGroup(prim); | 459 | objects[prim.UUID] = new SceneObjectGroup(prim); |
460 | if (prim.KeyframeMotion != null) | ||
461 | prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]); | ||
462 | } | ||
450 | } | 463 | } |
451 | 464 | ||
452 | // Add all of the children objects to the SOGs | 465 | // Add all of the children objects to the SOGs |
@@ -559,36 +572,51 @@ namespace OpenSim.Data.MySQL | |||
559 | } | 572 | } |
560 | } | 573 | } |
561 | 574 | ||
562 | public void StoreTerrain(double[,] ter, UUID regionID) | 575 | public virtual void StoreTerrain(double[,] ter, UUID regionID) |
563 | { | 576 | { |
564 | m_log.Info("[REGION DB]: Storing terrain"); | 577 | Util.FireAndForget(delegate(object x) |
565 | |||
566 | lock (m_dbLock) | ||
567 | { | 578 | { |
568 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 579 | double[,] oldTerrain = LoadTerrain(regionID); |
569 | { | ||
570 | dbcon.Open(); | ||
571 | 580 | ||
572 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 581 | m_log.Info("[REGION DB]: Storing terrain"); |
582 | |||
583 | lock (m_dbLock) | ||
584 | { | ||
585 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
573 | { | 586 | { |
574 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | 587 | dbcon.Open(); |
575 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
576 | 588 | ||
577 | ExecuteNonQuery(cmd); | 589 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
590 | { | ||
591 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | ||
592 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
578 | 593 | ||
579 | cmd.CommandText = "insert into terrain (RegionUUID, " + | 594 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) |
580 | "Revision, Heightfield) values (?RegionUUID, " + | 595 | { |
581 | "1, ?Heightfield)"; | 596 | try |
597 | { | ||
598 | cmd2.CommandText = "insert into terrain (RegionUUID, " + | ||
599 | "Revision, Heightfield) values (?RegionUUID, " + | ||
600 | "1, ?Heightfield)"; | ||
582 | 601 | ||
583 | cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); | 602 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); |
603 | cmd2.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter, oldTerrain)); | ||
584 | 604 | ||
585 | ExecuteNonQuery(cmd); | 605 | ExecuteNonQuery(cmd); |
606 | ExecuteNonQuery(cmd2); | ||
607 | } | ||
608 | catch (Exception e) | ||
609 | { | ||
610 | m_log.ErrorFormat(e.ToString()); | ||
611 | } | ||
612 | } | ||
613 | } | ||
586 | } | 614 | } |
587 | } | 615 | } |
588 | } | 616 | }); |
589 | } | 617 | } |
590 | 618 | ||
591 | public double[,] LoadTerrain(UUID regionID) | 619 | public virtual double[,] LoadTerrain(UUID regionID) |
592 | { | 620 | { |
593 | double[,] terrain = null; | 621 | double[,] terrain = null; |
594 | 622 | ||
@@ -638,7 +666,7 @@ namespace OpenSim.Data.MySQL | |||
638 | return terrain; | 666 | return terrain; |
639 | } | 667 | } |
640 | 668 | ||
641 | public void RemoveLandObject(UUID globalID) | 669 | public virtual void RemoveLandObject(UUID globalID) |
642 | { | 670 | { |
643 | lock (m_dbLock) | 671 | lock (m_dbLock) |
644 | { | 672 | { |
@@ -657,7 +685,7 @@ namespace OpenSim.Data.MySQL | |||
657 | } | 685 | } |
658 | } | 686 | } |
659 | 687 | ||
660 | public void StoreLandObject(ILandObject parcel) | 688 | public virtual void StoreLandObject(ILandObject parcel) |
661 | { | 689 | { |
662 | lock (m_dbLock) | 690 | lock (m_dbLock) |
663 | { | 691 | { |
@@ -714,7 +742,7 @@ namespace OpenSim.Data.MySQL | |||
714 | } | 742 | } |
715 | } | 743 | } |
716 | 744 | ||
717 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 745 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
718 | { | 746 | { |
719 | RegionLightShareData nWP = new RegionLightShareData(); | 747 | RegionLightShareData nWP = new RegionLightShareData(); |
720 | nWP.OnSave += StoreRegionWindlightSettings; | 748 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -738,7 +766,7 @@ namespace OpenSim.Data.MySQL | |||
738 | { | 766 | { |
739 | //No result, so store our default windlight profile and return it | 767 | //No result, so store our default windlight profile and return it |
740 | nWP.regionID = regionUUID; | 768 | nWP.regionID = regionUUID; |
741 | StoreRegionWindlightSettings(nWP); | 769 | // StoreRegionWindlightSettings(nWP); |
742 | return nWP; | 770 | return nWP; |
743 | } | 771 | } |
744 | else | 772 | else |
@@ -815,7 +843,7 @@ namespace OpenSim.Data.MySQL | |||
815 | return nWP; | 843 | return nWP; |
816 | } | 844 | } |
817 | 845 | ||
818 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 846 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
819 | { | 847 | { |
820 | RegionSettings rs = null; | 848 | RegionSettings rs = null; |
821 | 849 | ||
@@ -855,7 +883,7 @@ namespace OpenSim.Data.MySQL | |||
855 | return rs; | 883 | return rs; |
856 | } | 884 | } |
857 | 885 | ||
858 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 886 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
859 | { | 887 | { |
860 | lock (m_dbLock) | 888 | lock (m_dbLock) |
861 | { | 889 | { |
@@ -961,7 +989,7 @@ namespace OpenSim.Data.MySQL | |||
961 | } | 989 | } |
962 | } | 990 | } |
963 | 991 | ||
964 | public void RemoveRegionWindlightSettings(UUID regionID) | 992 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
965 | { | 993 | { |
966 | lock (m_dbLock) | 994 | lock (m_dbLock) |
967 | { | 995 | { |
@@ -1050,7 +1078,7 @@ namespace OpenSim.Data.MySQL | |||
1050 | } | 1078 | } |
1051 | #endregion | 1079 | #endregion |
1052 | 1080 | ||
1053 | public void StoreRegionSettings(RegionSettings rs) | 1081 | public virtual void StoreRegionSettings(RegionSettings rs) |
1054 | { | 1082 | { |
1055 | lock (m_dbLock) | 1083 | lock (m_dbLock) |
1056 | { | 1084 | { |
@@ -1077,7 +1105,7 @@ namespace OpenSim.Data.MySQL | |||
1077 | "use_estate_sun, fixed_sun, sun_position, " + | 1105 | "use_estate_sun, fixed_sun, sun_position, " + |
1078 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + | 1106 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + |
1079 | "sunvectorz, loaded_creation_datetime, " + | 1107 | "sunvectorz, loaded_creation_datetime, " + |
1080 | "loaded_creation_id, map_tile_ID, " + | 1108 | "loaded_creation_id, map_tile_ID, block_search, casino, " + |
1081 | "TelehubObject, parcel_tile_ID) " + | 1109 | "TelehubObject, parcel_tile_ID) " + |
1082 | "values (?RegionUUID, ?BlockTerraform, " + | 1110 | "values (?RegionUUID, ?BlockTerraform, " + |
1083 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1111 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
@@ -1094,7 +1122,8 @@ namespace OpenSim.Data.MySQL | |||
1094 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + | 1122 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + |
1095 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1123 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1096 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1124 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1097 | "?TerrainImageID, ?TelehubObject, ?ParcelImageID) "; | 1125 | "?TerrainImageID, ?block_search, ?casino, " + |
1126 | "?TelehubObject, ?ParcelImageID)"; | ||
1098 | 1127 | ||
1099 | FillRegionSettingsCommand(cmd, rs); | 1128 | FillRegionSettingsCommand(cmd, rs); |
1100 | 1129 | ||
@@ -1105,7 +1134,7 @@ namespace OpenSim.Data.MySQL | |||
1105 | SaveSpawnPoints(rs); | 1134 | SaveSpawnPoints(rs); |
1106 | } | 1135 | } |
1107 | 1136 | ||
1108 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1137 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1109 | { | 1138 | { |
1110 | List<LandData> landData = new List<LandData>(); | 1139 | List<LandData> landData = new List<LandData>(); |
1111 | 1140 | ||
@@ -1287,11 +1316,40 @@ namespace OpenSim.Data.MySQL | |||
1287 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; | 1316 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; |
1288 | 1317 | ||
1289 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); | 1318 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); |
1319 | prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); | ||
1290 | prim.LinkNum = (int)row["LinkNumber"]; | 1320 | prim.LinkNum = (int)row["LinkNumber"]; |
1291 | 1321 | ||
1292 | if (!(row["MediaURL"] is System.DBNull)) | 1322 | if (!(row["MediaURL"] is System.DBNull)) |
1293 | prim.MediaUrl = (string)row["MediaURL"]; | 1323 | prim.MediaUrl = (string)row["MediaURL"]; |
1294 | 1324 | ||
1325 | if (!(row["KeyframeMotion"] is DBNull)) | ||
1326 | { | ||
1327 | Byte[] data = (byte[])row["KeyframeMotion"]; | ||
1328 | if (data.Length > 0) | ||
1329 | prim.KeyframeMotion = KeyframeMotion.FromData(null, data); | ||
1330 | else | ||
1331 | prim.KeyframeMotion = null; | ||
1332 | } | ||
1333 | else | ||
1334 | { | ||
1335 | prim.KeyframeMotion = null; | ||
1336 | } | ||
1337 | |||
1338 | prim.PhysicsShapeType = (byte)Convert.ToInt32(row["PhysicsShapeType"].ToString()); | ||
1339 | prim.Density = (float)(double)row["Density"]; | ||
1340 | prim.GravityModifier = (float)(double)row["GravityModifier"]; | ||
1341 | prim.Friction = (float)(double)row["Friction"]; | ||
1342 | prim.Bounciness = (float)(double)row["Restitution"]; | ||
1343 | |||
1344 | SOPVehicle vehicle = null; | ||
1345 | |||
1346 | if (row["Vehicle"].ToString() != String.Empty) | ||
1347 | { | ||
1348 | vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString()); | ||
1349 | if (vehicle != null) | ||
1350 | prim.VehicleParams = vehicle; | ||
1351 | } | ||
1352 | |||
1295 | return prim; | 1353 | return prim; |
1296 | } | 1354 | } |
1297 | 1355 | ||
@@ -1302,32 +1360,40 @@ namespace OpenSim.Data.MySQL | |||
1302 | /// <returns></returns> | 1360 | /// <returns></returns> |
1303 | private static TaskInventoryItem BuildItem(IDataReader row) | 1361 | private static TaskInventoryItem BuildItem(IDataReader row) |
1304 | { | 1362 | { |
1305 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1363 | try |
1306 | 1364 | { | |
1307 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); | 1365 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1308 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); | 1366 | |
1309 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | 1367 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1310 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); | 1368 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1311 | 1369 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | |
1312 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1370 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1313 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1371 | |
1314 | 1372 | taskItem.InvType = Convert.ToInt32(row["invType"]); | |
1315 | taskItem.Name = (String)row["name"]; | 1373 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
1316 | taskItem.Description = (String)row["description"]; | 1374 | |
1317 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1375 | taskItem.Name = (String)row["name"]; |
1318 | taskItem.CreatorIdentification = (String)row["creatorID"]; | 1376 | taskItem.Description = (String)row["description"]; |
1319 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); | 1377 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1320 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | 1378 | taskItem.CreatorIdentification = (String)row["creatorID"]; |
1321 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); | 1379 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1322 | 1380 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | |
1323 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1381 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1324 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1382 | |
1325 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | 1383 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1326 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | 1384 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
1327 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | 1385 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); |
1328 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | 1386 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); |
1329 | 1387 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | |
1330 | return taskItem; | 1388 | taskItem.Flags = Convert.ToUInt32(row["flags"]); |
1389 | |||
1390 | return taskItem; | ||
1391 | } | ||
1392 | catch | ||
1393 | { | ||
1394 | m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString()); | ||
1395 | throw; | ||
1396 | } | ||
1331 | } | 1397 | } |
1332 | 1398 | ||
1333 | private static RegionSettings BuildRegionSettings(IDataReader row) | 1399 | private static RegionSettings BuildRegionSettings(IDataReader row) |
@@ -1385,6 +1451,9 @@ namespace OpenSim.Data.MySQL | |||
1385 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); | 1451 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); |
1386 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | 1452 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); |
1387 | 1453 | ||
1454 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1455 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1456 | |||
1388 | return newSettings; | 1457 | return newSettings; |
1389 | } | 1458 | } |
1390 | 1459 | ||
@@ -1482,7 +1551,7 @@ namespace OpenSim.Data.MySQL | |||
1482 | /// </summary> | 1551 | /// </summary> |
1483 | /// <param name="val"></param> | 1552 | /// <param name="val"></param> |
1484 | /// <returns></returns> | 1553 | /// <returns></returns> |
1485 | private static Array SerializeTerrain(double[,] val) | 1554 | private static Array SerializeTerrain(double[,] val, double[,] oldTerrain) |
1486 | { | 1555 | { |
1487 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); | 1556 | MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); |
1488 | BinaryWriter bw = new BinaryWriter(str); | 1557 | BinaryWriter bw = new BinaryWriter(str); |
@@ -1491,7 +1560,11 @@ namespace OpenSim.Data.MySQL | |||
1491 | for (int x = 0; x < (int)Constants.RegionSize; x++) | 1560 | for (int x = 0; x < (int)Constants.RegionSize; x++) |
1492 | for (int y = 0; y < (int)Constants.RegionSize; y++) | 1561 | for (int y = 0; y < (int)Constants.RegionSize; y++) |
1493 | { | 1562 | { |
1494 | double height = val[x, y]; | 1563 | double height = 20.0; |
1564 | if (oldTerrain != null) | ||
1565 | height = oldTerrain[x, y]; | ||
1566 | if (!double.IsNaN(val[x, y])) | ||
1567 | height = val[x, y]; | ||
1495 | if (height == 0.0) | 1568 | if (height == 0.0) |
1496 | height = double.Epsilon; | 1569 | height = double.Epsilon; |
1497 | 1570 | ||
@@ -1635,8 +1708,29 @@ namespace OpenSim.Data.MySQL | |||
1635 | else | 1708 | else |
1636 | cmd.Parameters.AddWithValue("PassTouches", 0); | 1709 | cmd.Parameters.AddWithValue("PassTouches", 0); |
1637 | 1710 | ||
1711 | if (prim.PassCollisions) | ||
1712 | cmd.Parameters.AddWithValue("PassCollisions", 1); | ||
1713 | else | ||
1714 | cmd.Parameters.AddWithValue("PassCollisions", 0); | ||
1715 | |||
1638 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); | 1716 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); |
1639 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); | 1717 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); |
1718 | |||
1719 | if (prim.KeyframeMotion != null) | ||
1720 | cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize()); | ||
1721 | else | ||
1722 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | ||
1723 | |||
1724 | cmd.Parameters.AddWithValue("PhysicsShapeType", prim.PhysicsShapeType); | ||
1725 | cmd.Parameters.AddWithValue("Density", (double)prim.Density); | ||
1726 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); | ||
1727 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); | ||
1728 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Bounciness); | ||
1729 | |||
1730 | if (prim.VehicleParams != null) | ||
1731 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1732 | else | ||
1733 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1640 | } | 1734 | } |
1641 | 1735 | ||
1642 | /// <summary> | 1736 | /// <summary> |
@@ -1715,6 +1809,9 @@ namespace OpenSim.Data.MySQL | |||
1715 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1809 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1716 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1810 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1717 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1811 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1812 | cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch); | ||
1813 | cmd.Parameters.AddWithValue("casino", settings.Casino); | ||
1814 | |||
1718 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); | 1815 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); |
1719 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | 1816 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); |
1720 | } | 1817 | } |
@@ -1875,7 +1972,7 @@ namespace OpenSim.Data.MySQL | |||
1875 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 1972 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1876 | } | 1973 | } |
1877 | 1974 | ||
1878 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 1975 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1879 | { | 1976 | { |
1880 | lock (m_dbLock) | 1977 | lock (m_dbLock) |
1881 | { | 1978 | { |
@@ -1919,6 +2016,37 @@ namespace OpenSim.Data.MySQL | |||
1919 | } | 2016 | } |
1920 | } | 2017 | } |
1921 | 2018 | ||
2019 | public UUID[] GetObjectIDs(UUID regionID) | ||
2020 | { | ||
2021 | List<UUID> uuids = new List<UUID>(); | ||
2022 | |||
2023 | lock (m_dbLock) | ||
2024 | { | ||
2025 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
2026 | { | ||
2027 | dbcon.Open(); | ||
2028 | |||
2029 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
2030 | { | ||
2031 | cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID"; | ||
2032 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
2033 | |||
2034 | using (IDataReader reader = ExecuteReader(cmd)) | ||
2035 | { | ||
2036 | while (reader.Read()) | ||
2037 | { | ||
2038 | UUID id = new UUID(reader["UUID"].ToString()); | ||
2039 | |||
2040 | uuids.Add(id); | ||
2041 | } | ||
2042 | } | ||
2043 | } | ||
2044 | } | ||
2045 | } | ||
2046 | |||
2047 | return uuids.ToArray(); | ||
2048 | } | ||
2049 | |||
1922 | private void LoadSpawnPoints(RegionSettings rs) | 2050 | private void LoadSpawnPoints(RegionSettings rs) |
1923 | { | 2051 | { |
1924 | rs.ClearSpawnPoints(); | 2052 | rs.ClearSpawnPoints(); |