diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 320 |
1 files changed, 209 insertions, 111 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index bb0ab75..46364a5 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -76,7 +76,7 @@ namespace OpenSim.Data.MySQL | |||
76 | Initialise(connectionString); | 76 | Initialise(connectionString); |
77 | } | 77 | } |
78 | 78 | ||
79 | public void Initialise(string connectionString) | 79 | public virtual void Initialise(string connectionString) |
80 | { | 80 | { |
81 | m_connectionString = connectionString; | 81 | m_connectionString = connectionString; |
82 | 82 | ||
@@ -123,7 +123,7 @@ namespace OpenSim.Data.MySQL | |||
123 | 123 | ||
124 | public void Dispose() {} | 124 | public void Dispose() {} |
125 | 125 | ||
126 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 126 | public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
127 | { | 127 | { |
128 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | 128 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); |
129 | 129 | ||
@@ -183,10 +183,12 @@ namespace OpenSim.Data.MySQL | |||
183 | "ParticleSystem, ClickAction, Material, " + | 183 | "ParticleSystem, ClickAction, Material, " + |
184 | "CollisionSound, CollisionSoundVolume, " + | 184 | "CollisionSound, CollisionSoundVolume, " + |
185 | "PassTouches, " + | 185 | "PassTouches, " + |
186 | "LinkNumber, MediaURL, AttachedPosX, " + | 186 | "PassCollisions, " + |
187 | "AttachedPosY, AttachedPosZ, KeyframeMotion, " + | 187 | "LinkNumber, MediaURL, KeyframeMotion, AttachedPosX, " + |
188 | "AttachedPosY, AttachedPosZ, " + | ||
188 | "PhysicsShapeType, Density, GravityModifier, " + | 189 | "PhysicsShapeType, Density, GravityModifier, " + |
189 | "Friction, Restitution, DynAttrs " + | 190 | "Friction, Restitution, Vehicle, DynAttrs, " + |
191 | "RotationAxisLocks" + | ||
190 | ") values (" + "?UUID, " + | 192 | ") values (" + "?UUID, " + |
191 | "?CreationDate, ?Name, ?Text, " + | 193 | "?CreationDate, ?Name, ?Text, " + |
192 | "?Description, ?SitName, ?TouchName, " + | 194 | "?Description, ?SitName, ?TouchName, " + |
@@ -218,11 +220,12 @@ namespace OpenSim.Data.MySQL | |||
218 | "?SaleType, ?ColorR, ?ColorG, " + | 220 | "?SaleType, ?ColorR, ?ColorG, " + |
219 | "?ColorB, ?ColorA, ?ParticleSystem, " + | 221 | "?ColorB, ?ColorA, ?ParticleSystem, " + |
220 | "?ClickAction, ?Material, ?CollisionSound, " + | 222 | "?ClickAction, ?Material, ?CollisionSound, " + |
221 | "?CollisionSoundVolume, ?PassTouches, " + | 223 | "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + |
222 | "?LinkNumber, ?MediaURL, ?AttachedPosX, " + | 224 | "?LinkNumber, ?MediaURL, ?KeyframeMotion, ?AttachedPosX, " + |
223 | "?AttachedPosY, ?AttachedPosZ, ?KeyframeMotion, " + | 225 | "?AttachedPosY, ?AttachedPosZ, " + |
224 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + | 226 | "?PhysicsShapeType, ?Density, ?GravityModifier, " + |
225 | "?Friction, ?Restitution, ?DynAttrs)"; | 227 | "?Friction, ?Restitution, ?Vehicle, ?DynAttrs," + |
228 | "?RotationAxisLocks)"; | ||
226 | 229 | ||
227 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); | 230 | FillPrimCommand(cmd, prim, obj.UUID, regionUUID); |
228 | 231 | ||
@@ -262,7 +265,7 @@ namespace OpenSim.Data.MySQL | |||
262 | } | 265 | } |
263 | } | 266 | } |
264 | 267 | ||
265 | public void RemoveObject(UUID obj, UUID regionUUID) | 268 | public virtual void RemoveObject(UUID obj, UUID regionUUID) |
266 | { | 269 | { |
267 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); | 270 | // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); |
268 | 271 | ||
@@ -317,7 +320,8 @@ namespace OpenSim.Data.MySQL | |||
317 | /// <param name="uuid">the Item UUID</param> | 320 | /// <param name="uuid">the Item UUID</param> |
318 | private void RemoveItems(UUID uuid) | 321 | private void RemoveItems(UUID uuid) |
319 | { | 322 | { |
320 | lock (m_dbLock) | 323 | // locked by caller |
324 | // lock (m_dbLock) | ||
321 | { | 325 | { |
322 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 326 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
323 | { | 327 | { |
@@ -411,7 +415,7 @@ namespace OpenSim.Data.MySQL | |||
411 | } | 415 | } |
412 | } | 416 | } |
413 | 417 | ||
414 | public List<SceneObjectGroup> LoadObjects(UUID regionID) | 418 | public virtual List<SceneObjectGroup> LoadObjects(UUID regionID) |
415 | { | 419 | { |
416 | const int ROWS_PER_QUERY = 5000; | 420 | const int ROWS_PER_QUERY = 5000; |
417 | 421 | ||
@@ -590,40 +594,53 @@ namespace OpenSim.Data.MySQL | |||
590 | 594 | ||
591 | public void StoreTerrain(TerrainData terrData, UUID regionID) | 595 | public void StoreTerrain(TerrainData terrData, UUID regionID) |
592 | { | 596 | { |
593 | lock (m_dbLock) | 597 | Util.FireAndForget(delegate(object x) |
594 | { | 598 | { |
595 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 599 | m_log.Info("[REGION DB]: Storing terrain"); |
596 | { | ||
597 | dbcon.Open(); | ||
598 | 600 | ||
599 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 601 | lock (m_dbLock) |
602 | { | ||
603 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
600 | { | 604 | { |
601 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; | 605 | dbcon.Open(); |
602 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
603 | |||
604 | ExecuteNonQuery(cmd); | ||
605 | 606 | ||
606 | int terrainDBRevision; | 607 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
607 | Array terrainDBblob; | 608 | { |
608 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | 609 | cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; |
610 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
609 | 611 | ||
610 | m_log.InfoFormat("{0} Storing terrain. X={1}, Y={2}, rev={3}", | 612 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) |
611 | LogHeader, terrData.SizeX, terrData.SizeY, terrainDBRevision); | 613 | { |
614 | try | ||
615 | { | ||
616 | cmd2.CommandText = "insert into terrain (RegionUUID, " + | ||
617 | "Revision, Heightfield) values (?RegionUUID, " + | ||
618 | "?Revision, ?Heightfield)"; | ||
612 | 619 | ||
613 | cmd.CommandText = "insert into terrain (RegionUUID, Revision, Heightfield)" | 620 | int terrainDBRevision; |
614 | + "values (?RegionUUID, ?Revision, ?Heightfield)"; | 621 | Array terrainDBblob; |
622 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | ||
615 | 623 | ||
616 | cmd.Parameters.AddWithValue("Revision", terrainDBRevision); | 624 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); |
617 | cmd.Parameters.AddWithValue("Heightfield", terrainDBblob); | 625 | cmd2.Parameters.AddWithValue("Revision", terrainDBRevision); |
626 | cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob); | ||
618 | 627 | ||
619 | ExecuteNonQuery(cmd); | 628 | ExecuteNonQuery(cmd); |
629 | ExecuteNonQuery(cmd2); | ||
630 | } | ||
631 | catch (Exception e) | ||
632 | { | ||
633 | m_log.ErrorFormat(e.ToString()); | ||
634 | } | ||
635 | } | ||
636 | } | ||
620 | } | 637 | } |
621 | } | 638 | } |
622 | } | 639 | }); |
623 | } | 640 | } |
624 | 641 | ||
625 | // Legacy region loading | 642 | // Legacy region loading |
626 | public double[,] LoadTerrain(UUID regionID) | 643 | public virtual double[,] LoadTerrain(UUID regionID) |
627 | { | 644 | { |
628 | double[,] ret = null; | 645 | double[,] ret = null; |
629 | TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); | 646 | TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); |
@@ -655,8 +672,11 @@ namespace OpenSim.Data.MySQL | |||
655 | while (reader.Read()) | 672 | while (reader.Read()) |
656 | { | 673 | { |
657 | int rev = Convert.ToInt32(reader["Revision"]); | 674 | int rev = Convert.ToInt32(reader["Revision"]); |
658 | byte[] blob = (byte[])reader["Heightfield"]; | 675 | if ((reader["Heightfield"] != DBNull.Value)) |
659 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | 676 | { |
677 | byte[] blob = (byte[])reader["Heightfield"]; | ||
678 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
679 | } | ||
660 | } | 680 | } |
661 | } | 681 | } |
662 | } | 682 | } |
@@ -666,7 +686,7 @@ namespace OpenSim.Data.MySQL | |||
666 | return terrData; | 686 | return terrData; |
667 | } | 687 | } |
668 | 688 | ||
669 | public void RemoveLandObject(UUID globalID) | 689 | public virtual void RemoveLandObject(UUID globalID) |
670 | { | 690 | { |
671 | lock (m_dbLock) | 691 | lock (m_dbLock) |
672 | { | 692 | { |
@@ -685,7 +705,7 @@ namespace OpenSim.Data.MySQL | |||
685 | } | 705 | } |
686 | } | 706 | } |
687 | 707 | ||
688 | public void StoreLandObject(ILandObject parcel) | 708 | public virtual void StoreLandObject(ILandObject parcel) |
689 | { | 709 | { |
690 | lock (m_dbLock) | 710 | lock (m_dbLock) |
691 | { | 711 | { |
@@ -705,7 +725,8 @@ namespace OpenSim.Data.MySQL | |||
705 | "UserLocationX, UserLocationY, UserLocationZ, " + | 725 | "UserLocationX, UserLocationY, UserLocationZ, " + |
706 | "UserLookAtX, UserLookAtY, UserLookAtZ, " + | 726 | "UserLookAtX, UserLookAtY, UserLookAtZ, " + |
707 | "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + | 727 | "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " + |
708 | "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + | 728 | "MediaSize, MediaLoop, ObscureMusic, ObscureMedia, " + |
729 | "SeeAVs, AnyAVSounds, GroupAVSounds) values (" + | ||
709 | "?UUID, ?RegionUUID, " + | 730 | "?UUID, ?RegionUUID, " + |
710 | "?LocalLandID, ?Bitmap, ?Name, ?Description, " + | 731 | "?LocalLandID, ?Bitmap, ?Name, ?Description, " + |
711 | "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + | 732 | "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + |
@@ -716,7 +737,8 @@ namespace OpenSim.Data.MySQL | |||
716 | "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + | 737 | "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + |
717 | "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + | 738 | "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + |
718 | "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ | 739 | "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+ |
719 | "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; | 740 | "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia, " + |
741 | "?SeeAVs, ?AnyAVSounds, ?GroupAVSounds)"; | ||
720 | 742 | ||
721 | FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); | 743 | FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); |
722 | 744 | ||
@@ -742,7 +764,7 @@ namespace OpenSim.Data.MySQL | |||
742 | } | 764 | } |
743 | } | 765 | } |
744 | 766 | ||
745 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 767 | public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
746 | { | 768 | { |
747 | RegionLightShareData nWP = new RegionLightShareData(); | 769 | RegionLightShareData nWP = new RegionLightShareData(); |
748 | nWP.OnSave += StoreRegionWindlightSettings; | 770 | nWP.OnSave += StoreRegionWindlightSettings; |
@@ -840,7 +862,7 @@ namespace OpenSim.Data.MySQL | |||
840 | return nWP; | 862 | return nWP; |
841 | } | 863 | } |
842 | 864 | ||
843 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 865 | public virtual RegionSettings LoadRegionSettings(UUID regionUUID) |
844 | { | 866 | { |
845 | RegionSettings rs = null; | 867 | RegionSettings rs = null; |
846 | 868 | ||
@@ -880,7 +902,7 @@ namespace OpenSim.Data.MySQL | |||
880 | return rs; | 902 | return rs; |
881 | } | 903 | } |
882 | 904 | ||
883 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 905 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
884 | { | 906 | { |
885 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 907 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
886 | { | 908 | { |
@@ -983,7 +1005,7 @@ namespace OpenSim.Data.MySQL | |||
983 | } | 1005 | } |
984 | } | 1006 | } |
985 | 1007 | ||
986 | public void RemoveRegionWindlightSettings(UUID regionID) | 1008 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
987 | { | 1009 | { |
988 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1010 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
989 | { | 1011 | { |
@@ -1060,7 +1082,7 @@ namespace OpenSim.Data.MySQL | |||
1060 | } | 1082 | } |
1061 | #endregion | 1083 | #endregion |
1062 | 1084 | ||
1063 | public void StoreRegionSettings(RegionSettings rs) | 1085 | public virtual void StoreRegionSettings(RegionSettings rs) |
1064 | { | 1086 | { |
1065 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1087 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1066 | { | 1088 | { |
@@ -1069,52 +1091,51 @@ namespace OpenSim.Data.MySQL | |||
1069 | using (MySqlCommand cmd = dbcon.CreateCommand()) | 1091 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
1070 | { | 1092 | { |
1071 | cmd.CommandText = "replace into regionsettings (regionUUID, " + | 1093 | cmd.CommandText = "replace into regionsettings (regionUUID, " + |
1072 | "block_terraform, block_fly, allow_damage, " + | 1094 | "block_terraform, block_fly, allow_damage, " + |
1073 | "restrict_pushing, allow_land_resell, " + | 1095 | "restrict_pushing, allow_land_resell, " + |
1074 | "allow_land_join_divide, block_show_in_search, " + | 1096 | "allow_land_join_divide, block_show_in_search, " + |
1075 | "agent_limit, object_bonus, maturity, " + | 1097 | "agent_limit, object_bonus, maturity, " + |
1076 | "disable_scripts, disable_collisions, " + | 1098 | "disable_scripts, disable_collisions, " + |
1077 | "disable_physics, terrain_texture_1, " + | 1099 | "disable_physics, terrain_texture_1, " + |
1078 | "terrain_texture_2, terrain_texture_3, " + | 1100 | "terrain_texture_2, terrain_texture_3, " + |
1079 | "terrain_texture_4, elevation_1_nw, " + | 1101 | "terrain_texture_4, elevation_1_nw, " + |
1080 | "elevation_2_nw, elevation_1_ne, " + | 1102 | "elevation_2_nw, elevation_1_ne, " + |
1081 | "elevation_2_ne, elevation_1_se, " + | 1103 | "elevation_2_ne, elevation_1_se, " + |
1082 | "elevation_2_se, elevation_1_sw, " + | 1104 | "elevation_2_se, elevation_1_sw, " + |
1083 | "elevation_2_sw, water_height, " + | 1105 | "elevation_2_sw, water_height, " + |
1084 | "terrain_raise_limit, terrain_lower_limit, " + | 1106 | "terrain_raise_limit, terrain_lower_limit, " + |
1085 | "use_estate_sun, fixed_sun, sun_position, " + | 1107 | "use_estate_sun, fixed_sun, sun_position, " + |
1086 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + | 1108 | "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + |
1087 | "sunvectorz, loaded_creation_datetime, " + | 1109 | "sunvectorz, loaded_creation_datetime, " + |
1088 | "loaded_creation_id, map_tile_ID, " + | 1110 | "loaded_creation_id, map_tile_ID, block_search, casino, " + |
1089 | "TelehubObject, parcel_tile_ID) " + | 1111 | "TelehubObject, parcel_tile_ID) " + |
1090 | "values (?RegionUUID, ?BlockTerraform, " + | 1112 | "values (?RegionUUID, ?BlockTerraform, " + |
1091 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + | 1113 | "?BlockFly, ?AllowDamage, ?RestrictPushing, " + |
1092 | "?AllowLandResell, ?AllowLandJoinDivide, " + | 1114 | "?AllowLandResell, ?AllowLandJoinDivide, " + |
1093 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + | 1115 | "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + |
1094 | "?Maturity, ?DisableScripts, ?DisableCollisions, " + | 1116 | "?Maturity, ?DisableScripts, ?DisableCollisions, " + |
1095 | "?DisablePhysics, ?TerrainTexture1, " + | 1117 | "?DisablePhysics, ?TerrainTexture1, " + |
1096 | "?TerrainTexture2, ?TerrainTexture3, " + | 1118 | "?TerrainTexture2, ?TerrainTexture3, " + |
1097 | "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + | 1119 | "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + |
1098 | "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + | 1120 | "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + |
1099 | "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + | 1121 | "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + |
1100 | "?WaterHeight, ?TerrainRaiseLimit, " + | 1122 | "?WaterHeight, ?TerrainRaiseLimit, " + |
1101 | "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + | 1123 | "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + |
1102 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + | 1124 | "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + |
1103 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + | 1125 | "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + |
1104 | "?LoadedCreationDateTime, ?LoadedCreationID, " + | 1126 | "?LoadedCreationDateTime, ?LoadedCreationID, " + |
1105 | "?TerrainImageID, " + | 1127 | "?TerrainImageID, ?block_search, ?casino, " + |
1106 | "?TelehubObject, ?ParcelImageID)"; | 1128 | "?TelehubObject, ?ParcelImageID)"; |
1107 | 1129 | ||
1108 | FillRegionSettingsCommand(cmd, rs); | 1130 | FillRegionSettingsCommand(cmd, rs); |
1109 | |||
1110 | ExecuteNonQuery(cmd); | 1131 | ExecuteNonQuery(cmd); |
1111 | } | 1132 | } |
1112 | } | ||
1113 | 1133 | ||
1114 | SaveSpawnPoints(rs); | 1134 | SaveSpawnPoints(rs); |
1135 | } | ||
1115 | } | 1136 | } |
1116 | 1137 | ||
1117 | public List<LandData> LoadLandObjects(UUID regionUUID) | 1138 | public virtual List<LandData> LoadLandObjects(UUID regionUUID) |
1118 | { | 1139 | { |
1119 | List<LandData> landData = new List<LandData>(); | 1140 | List<LandData> landData = new List<LandData>(); |
1120 | 1141 | ||
@@ -1296,6 +1317,7 @@ namespace OpenSim.Data.MySQL | |||
1296 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; | 1317 | prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; |
1297 | 1318 | ||
1298 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); | 1319 | prim.PassTouches = ((sbyte)row["PassTouches"] != 0); |
1320 | prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); | ||
1299 | prim.LinkNum = (int)row["LinkNumber"]; | 1321 | prim.LinkNum = (int)row["LinkNumber"]; |
1300 | 1322 | ||
1301 | if (!(row["MediaURL"] is System.DBNull)) | 1323 | if (!(row["MediaURL"] is System.DBNull)) |
@@ -1333,7 +1355,17 @@ namespace OpenSim.Data.MySQL | |||
1333 | prim.GravityModifier = (float)(double)row["GravityModifier"]; | 1355 | prim.GravityModifier = (float)(double)row["GravityModifier"]; |
1334 | prim.Friction = (float)(double)row["Friction"]; | 1356 | prim.Friction = (float)(double)row["Friction"]; |
1335 | prim.Restitution = (float)(double)row["Restitution"]; | 1357 | prim.Restitution = (float)(double)row["Restitution"]; |
1336 | 1358 | prim.RotationAxisLocks = (byte)Convert.ToInt32(row["RotationAxisLocks"].ToString()); | |
1359 | |||
1360 | SOPVehicle vehicle = null; | ||
1361 | |||
1362 | if (row["Vehicle"].ToString() != String.Empty) | ||
1363 | { | ||
1364 | vehicle = SOPVehicle.FromXml2(row["Vehicle"].ToString()); | ||
1365 | if (vehicle != null) | ||
1366 | prim.VehicleParams = vehicle; | ||
1367 | } | ||
1368 | |||
1337 | return prim; | 1369 | return prim; |
1338 | } | 1370 | } |
1339 | 1371 | ||
@@ -1344,32 +1376,40 @@ namespace OpenSim.Data.MySQL | |||
1344 | /// <returns></returns> | 1376 | /// <returns></returns> |
1345 | private static TaskInventoryItem BuildItem(IDataReader row) | 1377 | private static TaskInventoryItem BuildItem(IDataReader row) |
1346 | { | 1378 | { |
1347 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 1379 | try |
1348 | 1380 | { | |
1349 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); | 1381 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
1350 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); | 1382 | |
1351 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | 1383 | taskItem.ItemID = DBGuid.FromDB(row["itemID"]); |
1352 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); | 1384 | taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); |
1353 | 1385 | taskItem.AssetID = DBGuid.FromDB(row["assetID"]); | |
1354 | taskItem.InvType = Convert.ToInt32(row["invType"]); | 1386 | taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); |
1355 | taskItem.Type = Convert.ToInt32(row["assetType"]); | 1387 | |
1356 | 1388 | taskItem.InvType = Convert.ToInt32(row["invType"]); | |
1357 | taskItem.Name = (String)row["name"]; | 1389 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
1358 | taskItem.Description = (String)row["description"]; | 1390 | |
1359 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); | 1391 | taskItem.Name = (String)row["name"]; |
1360 | taskItem.CreatorIdentification = (String)row["creatorID"]; | 1392 | taskItem.Description = (String)row["description"]; |
1361 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); | 1393 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
1362 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | 1394 | taskItem.CreatorIdentification = (String)row["creatorID"]; |
1363 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); | 1395 | taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); |
1364 | 1396 | taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); | |
1365 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); | 1397 | taskItem.GroupID = DBGuid.FromDB(row["groupID"]); |
1366 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); | 1398 | |
1367 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); | 1399 | taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); |
1368 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); | 1400 | taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); |
1369 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | 1401 | taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); |
1370 | taskItem.Flags = Convert.ToUInt32(row["flags"]); | 1402 | taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); |
1371 | 1403 | taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); | |
1372 | return taskItem; | 1404 | taskItem.Flags = Convert.ToUInt32(row["flags"]); |
1405 | |||
1406 | return taskItem; | ||
1407 | } | ||
1408 | catch | ||
1409 | { | ||
1410 | m_log.ErrorFormat("[MYSQL DB]: Error reading task inventory: itemID was {0}, primID was {1}", row["itemID"].ToString(), row["primID"].ToString()); | ||
1411 | throw; | ||
1412 | } | ||
1373 | } | 1413 | } |
1374 | 1414 | ||
1375 | private static RegionSettings BuildRegionSettings(IDataReader row) | 1415 | private static RegionSettings BuildRegionSettings(IDataReader row) |
@@ -1427,6 +1467,9 @@ namespace OpenSim.Data.MySQL | |||
1427 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); | 1467 | newSettings.ParcelImageID = DBGuid.FromDB(row["parcel_tile_ID"]); |
1428 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); | 1468 | newSettings.TelehubObject = DBGuid.FromDB(row["TelehubObject"]); |
1429 | 1469 | ||
1470 | newSettings.GodBlockSearch = Convert.ToBoolean(row["block_search"]); | ||
1471 | newSettings.Casino = Convert.ToBoolean(row["casino"]); | ||
1472 | |||
1430 | return newSettings; | 1473 | return newSettings; |
1431 | } | 1474 | } |
1432 | 1475 | ||
@@ -1503,6 +1546,13 @@ namespace OpenSim.Data.MySQL | |||
1503 | 1546 | ||
1504 | newData.ParcelAccessList = new List<LandAccessEntry>(); | 1547 | newData.ParcelAccessList = new List<LandAccessEntry>(); |
1505 | 1548 | ||
1549 | if (!(row["SeeAVs"] is System.DBNull)) | ||
1550 | newData.SeeAVs = Convert.ToInt32(row["SeeAVs"]) != 0 ? true : false; | ||
1551 | if (!(row["AnyAVSounds"] is System.DBNull)) | ||
1552 | newData.AnyAVSounds = Convert.ToInt32(row["AnyAVSounds"]) != 0 ? true : false; | ||
1553 | if (!(row["GroupAVSounds"] is System.DBNull)) | ||
1554 | newData.GroupAVSounds = Convert.ToInt32(row["GroupAVSounds"]) != 0 ? true : false; | ||
1555 | |||
1506 | return newData; | 1556 | return newData; |
1507 | } | 1557 | } |
1508 | 1558 | ||
@@ -1654,6 +1704,11 @@ namespace OpenSim.Data.MySQL | |||
1654 | else | 1704 | else |
1655 | cmd.Parameters.AddWithValue("PassTouches", 0); | 1705 | cmd.Parameters.AddWithValue("PassTouches", 0); |
1656 | 1706 | ||
1707 | if (prim.PassCollisions) | ||
1708 | cmd.Parameters.AddWithValue("PassCollisions", 1); | ||
1709 | else | ||
1710 | cmd.Parameters.AddWithValue("PassCollisions", 0); | ||
1711 | |||
1657 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); | 1712 | cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); |
1658 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); | 1713 | cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); |
1659 | if (prim.AttachedPos != null) | 1714 | if (prim.AttachedPos != null) |
@@ -1668,6 +1723,11 @@ namespace OpenSim.Data.MySQL | |||
1668 | else | 1723 | else |
1669 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); | 1724 | cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]); |
1670 | 1725 | ||
1726 | if (prim.VehicleParams != null) | ||
1727 | cmd.Parameters.AddWithValue("Vehicle", prim.VehicleParams.ToXml2()); | ||
1728 | else | ||
1729 | cmd.Parameters.AddWithValue("Vehicle", String.Empty); | ||
1730 | |||
1671 | if (prim.DynAttrs.CountNamespaces > 0) | 1731 | if (prim.DynAttrs.CountNamespaces > 0) |
1672 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); | 1732 | cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml()); |
1673 | else | 1733 | else |
@@ -1678,6 +1738,7 @@ namespace OpenSim.Data.MySQL | |||
1678 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); | 1738 | cmd.Parameters.AddWithValue("GravityModifier", (double)prim.GravityModifier); |
1679 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); | 1739 | cmd.Parameters.AddWithValue("Friction", (double)prim.Friction); |
1680 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); | 1740 | cmd.Parameters.AddWithValue("Restitution", (double)prim.Restitution); |
1741 | cmd.Parameters.AddWithValue("RotationAxisLocks", prim.RotationAxisLocks); | ||
1681 | } | 1742 | } |
1682 | 1743 | ||
1683 | /// <summary> | 1744 | /// <summary> |
@@ -1756,6 +1817,8 @@ namespace OpenSim.Data.MySQL | |||
1756 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); | 1817 | cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); |
1757 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); | 1818 | cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); |
1758 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); | 1819 | cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); |
1820 | cmd.Parameters.AddWithValue("block_search", settings.GodBlockSearch); | ||
1821 | cmd.Parameters.AddWithValue("casino", settings.Casino); | ||
1759 | 1822 | ||
1760 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); | 1823 | cmd.Parameters.AddWithValue("ParcelImageID", settings.ParcelImageID); |
1761 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); | 1824 | cmd.Parameters.AddWithValue("TelehubObject", settings.TelehubObject); |
@@ -1813,6 +1876,10 @@ namespace OpenSim.Data.MySQL | |||
1813 | cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); | 1876 | cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); |
1814 | cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); | 1877 | cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); |
1815 | cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); | 1878 | cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); |
1879 | cmd.Parameters.AddWithValue("SeeAVs", land.SeeAVs ? 1 : 0); | ||
1880 | cmd.Parameters.AddWithValue("AnyAVSounds", land.AnyAVSounds ? 1 : 0); | ||
1881 | cmd.Parameters.AddWithValue("GroupAVSounds", land.GroupAVSounds ? 1 : 0); | ||
1882 | |||
1816 | } | 1883 | } |
1817 | 1884 | ||
1818 | /// <summary> | 1885 | /// <summary> |
@@ -1919,7 +1986,7 @@ namespace OpenSim.Data.MySQL | |||
1919 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); | 1986 | cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); |
1920 | } | 1987 | } |
1921 | 1988 | ||
1922 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 1989 | public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
1923 | { | 1990 | { |
1924 | lock (m_dbLock) | 1991 | lock (m_dbLock) |
1925 | { | 1992 | { |
@@ -1963,6 +2030,37 @@ namespace OpenSim.Data.MySQL | |||
1963 | } | 2030 | } |
1964 | } | 2031 | } |
1965 | 2032 | ||
2033 | public UUID[] GetObjectIDs(UUID regionID) | ||
2034 | { | ||
2035 | List<UUID> uuids = new List<UUID>(); | ||
2036 | |||
2037 | lock (m_dbLock) | ||
2038 | { | ||
2039 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
2040 | { | ||
2041 | dbcon.Open(); | ||
2042 | |||
2043 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
2044 | { | ||
2045 | cmd.CommandText = "select UUID from prims where RegionUUID = ?RegionUUID and SceneGroupID = UUID"; | ||
2046 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
2047 | |||
2048 | using (IDataReader reader = ExecuteReader(cmd)) | ||
2049 | { | ||
2050 | while (reader.Read()) | ||
2051 | { | ||
2052 | UUID id = new UUID(reader["UUID"].ToString()); | ||
2053 | |||
2054 | uuids.Add(id); | ||
2055 | } | ||
2056 | } | ||
2057 | } | ||
2058 | } | ||
2059 | } | ||
2060 | |||
2061 | return uuids.ToArray(); | ||
2062 | } | ||
2063 | |||
1966 | private void LoadSpawnPoints(RegionSettings rs) | 2064 | private void LoadSpawnPoints(RegionSettings rs) |
1967 | { | 2065 | { |
1968 | rs.ClearSpawnPoints(); | 2066 | rs.ClearSpawnPoints(); |