aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Data/PGSQL/PGSQLSimulationData.cs
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Data/PGSQL/PGSQLSimulationData.cs')
-rwxr-xr-x[-rw-r--r--]OpenSim/Data/PGSQL/PGSQLSimulationData.cs307
1 files changed, 224 insertions, 83 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
index 77d87d4..f4af40b 100644..100755
--- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
+++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs
@@ -31,11 +31,13 @@ using System.Data;
31using System.Drawing; 31using System.Drawing;
32using System.IO; 32using System.IO;
33using System.Reflection; 33using System.Reflection;
34using System.Threading;
34using log4net; 35using log4net;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenSim.Framework; 37using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Data;
39using Npgsql; 41using Npgsql;
40 42
41namespace OpenSim.Data.PGSQL 43namespace OpenSim.Data.PGSQL
@@ -108,11 +110,11 @@ namespace OpenSim.Data.PGSQL
108 Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>(); 110 Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
109 SceneObjectGroup grp = null; 111 SceneObjectGroup grp = null;
110 112
111 string sql = @"SELECT *, 113 string sql = @"SELECT *,
112 CASE WHEN prims.""UUID"" = prims.""SceneGroupID"" THEN 0 ELSE 1 END as sort 114 CASE WHEN prims.""UUID"" = prims.""SceneGroupID"" THEN 0 ELSE 1 END as sort
113 FROM prims 115 FROM prims
114 LEFT JOIN primshapes ON prims.""UUID"" = primshapes.""UUID"" 116 LEFT JOIN primshapes ON prims.""UUID"" = primshapes.""UUID""
115 WHERE ""RegionUUID"" = :RegionUUID 117 WHERE ""RegionUUID"" = :RegionUUID
116 ORDER BY ""SceneGroupID"" asc, sort asc, ""LinkNumber"" asc"; 118 ORDER BY ""SceneGroupID"" asc, sort asc, ""LinkNumber"" asc";
117 119
118 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) 120 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
@@ -144,7 +146,7 @@ namespace OpenSim.Data.PGSQL
144 // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are 146 // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are
145 // recorded as the root prim (for which the UUID must equal the persisted group UUID). In 147 // recorded as the root prim (for which the UUID must equal the persisted group UUID). In
146 // this case, force the UUID to be the same as the group UUID so that at least these can be 148 // this case, force the UUID to be the same as the group UUID so that at least these can be
147 // deleted (we need to change the UUID so that any other prims in the linkset can also be 149 // deleted (we need to change the UUID so that any other prims in the linkset can also be
148 // deleted). 150 // deleted).
149 if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero) 151 if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero)
150 { 152 {
@@ -176,7 +178,7 @@ namespace OpenSim.Data.PGSQL
176 objects[grp.UUID] = grp; 178 objects[grp.UUID] = grp;
177 179
178 // Instead of attempting to LoadItems on every prim, 180 // Instead of attempting to LoadItems on every prim,
179 // most of which probably have no items... get a 181 // most of which probably have no items... get a
180 // list from DB of all prims which have items and 182 // list from DB of all prims which have items and
181 // LoadItems only on those 183 // LoadItems only on those
182 List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); 184 List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>();
@@ -329,54 +331,55 @@ namespace OpenSim.Data.PGSQL
329 private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) 331 private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID)
330 { 332 {
331 //Big query to update or insert a new prim. 333 //Big query to update or insert a new prim.
332 334
333 string queryPrims = @" 335 string queryPrims = @"
334 UPDATE prims SET 336 UPDATE prims SET
335 ""CreationDate"" = :CreationDate, ""Name"" = :Name, ""Text"" = :Text, ""Description"" = :Description, ""SitName"" = :SitName, 337 ""CreationDate"" = :CreationDate, ""Name"" = :Name, ""Text"" = :Text, ""Description"" = :Description, ""SitName"" = :SitName,
336 ""TouchName"" = :TouchName, ""ObjectFlags"" = :ObjectFlags, ""OwnerMask"" = :OwnerMask, ""NextOwnerMask"" = :NextOwnerMask, ""GroupMask"" = :GroupMask, 338 ""TouchName"" = :TouchName, ""ObjectFlags"" = :ObjectFlags, ""OwnerMask"" = :OwnerMask, ""NextOwnerMask"" = :NextOwnerMask, ""GroupMask"" = :GroupMask,
337 ""EveryoneMask"" = :EveryoneMask, ""BaseMask"" = :BaseMask, ""PositionX"" = :PositionX, ""PositionY"" = :PositionY, ""PositionZ"" = :PositionZ, 339 ""EveryoneMask"" = :EveryoneMask, ""BaseMask"" = :BaseMask, ""PositionX"" = :PositionX, ""PositionY"" = :PositionY, ""PositionZ"" = :PositionZ,
338 ""GroupPositionX"" = :GroupPositionX, ""GroupPositionY"" = :GroupPositionY, ""GroupPositionZ"" = :GroupPositionZ, ""VelocityX"" = :VelocityX, 340 ""GroupPositionX"" = :GroupPositionX, ""GroupPositionY"" = :GroupPositionY, ""GroupPositionZ"" = :GroupPositionZ, ""VelocityX"" = :VelocityX,
339 ""VelocityY"" = :VelocityY, ""VelocityZ"" = :VelocityZ, ""AngularVelocityX"" = :AngularVelocityX, ""AngularVelocityY"" = :AngularVelocityY, 341 ""VelocityY"" = :VelocityY, ""VelocityZ"" = :VelocityZ, ""AngularVelocityX"" = :AngularVelocityX, ""AngularVelocityY"" = :AngularVelocityY,
340 ""AngularVelocityZ"" = :AngularVelocityZ, ""AccelerationX"" = :AccelerationX, ""AccelerationY"" = :AccelerationY, 342 ""AngularVelocityZ"" = :AngularVelocityZ, ""AccelerationX"" = :AccelerationX, ""AccelerationY"" = :AccelerationY,
341 ""AccelerationZ"" = :AccelerationZ, ""RotationX"" = :RotationX, ""RotationY"" = :RotationY, ""RotationZ"" = :RotationZ, ""RotationW"" = :RotationW, 343 ""AccelerationZ"" = :AccelerationZ, ""RotationX"" = :RotationX, ""RotationY"" = :RotationY, ""RotationZ"" = :RotationZ, ""RotationW"" = :RotationW,
342 ""SitTargetOffsetX"" = :SitTargetOffsetX, ""SitTargetOffsetY"" = :SitTargetOffsetY, ""SitTargetOffsetZ"" = :SitTargetOffsetZ, 344 ""SitTargetOffsetX"" = :SitTargetOffsetX, ""SitTargetOffsetY"" = :SitTargetOffsetY, ""SitTargetOffsetZ"" = :SitTargetOffsetZ,
343 ""SitTargetOrientW"" = :SitTargetOrientW, ""SitTargetOrientX"" = :SitTargetOrientX, ""SitTargetOrientY"" = :SitTargetOrientY, 345 ""SitTargetOrientW"" = :SitTargetOrientW, ""SitTargetOrientX"" = :SitTargetOrientX, ""SitTargetOrientY"" = :SitTargetOrientY,
344 ""SitTargetOrientZ"" = :SitTargetOrientZ, ""RegionUUID"" = :RegionUUID, ""CreatorID"" = :CreatorID, ""OwnerID"" = :OwnerID, ""GroupID"" = :GroupID, 346 ""SitTargetOrientZ"" = :SitTargetOrientZ, ""RegionUUID"" = :RegionUUID, ""CreatorID"" = :CreatorID, ""OwnerID"" = :OwnerID, ""GroupID"" = :GroupID,
345 ""LastOwnerID"" = :LastOwnerID, ""SceneGroupID"" = :SceneGroupID, ""PayPrice"" = :PayPrice, ""PayButton1"" = :PayButton1, ""PayButton2"" = :PayButton2, 347 ""LastOwnerID"" = :LastOwnerID, ""SceneGroupID"" = :SceneGroupID, ""PayPrice"" = :PayPrice, ""PayButton1"" = :PayButton1, ""PayButton2"" = :PayButton2,
346 ""PayButton3"" = :PayButton3, ""PayButton4"" = :PayButton4, ""LoopedSound"" = :LoopedSound, ""LoopedSoundGain"" = :LoopedSoundGain, 348 ""PayButton3"" = :PayButton3, ""PayButton4"" = :PayButton4, ""LoopedSound"" = :LoopedSound, ""LoopedSoundGain"" = :LoopedSoundGain,
347 ""TextureAnimation"" = :TextureAnimation, ""OmegaX"" = :OmegaX, ""OmegaY"" = :OmegaY, ""OmegaZ"" = :OmegaZ, ""CameraEyeOffsetX"" = :CameraEyeOffsetX, 349 ""TextureAnimation"" = :TextureAnimation, ""OmegaX"" = :OmegaX, ""OmegaY"" = :OmegaY, ""OmegaZ"" = :OmegaZ, ""CameraEyeOffsetX"" = :CameraEyeOffsetX,
348 ""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX, 350 ""CameraEyeOffsetY"" = :CameraEyeOffsetY, ""CameraEyeOffsetZ"" = :CameraEyeOffsetZ, ""CameraAtOffsetX"" = :CameraAtOffsetX,
349 ""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook, 351 ""CameraAtOffsetY"" = :CameraAtOffsetY, ""CameraAtOffsetZ"" = :CameraAtOffsetZ, ""ForceMouselook"" = :ForceMouselook,
350 ""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice, 352 ""ScriptAccessPin"" = :ScriptAccessPin, ""AllowedDrop"" = :AllowedDrop, ""DieAtEdge"" = :DieAtEdge, ""SalePrice"" = :SalePrice,
351 ""SaleType"" = :SaleType, ""ColorR"" = :ColorR, ""ColorG"" = :ColorG, ""ColorB"" = :ColorB, ""ColorA"" = :ColorA, ""ParticleSystem"" = :ParticleSystem, 353 ""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution,
354 ""PassCollisions"" = :PassCollisions, ""RotationAxisLocks"" = :RotationAxisLocks, ""RezzerID"" = :RezzerID,
352 ""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches, 355 ""ClickAction"" = :ClickAction, ""Material"" = :Material, ""CollisionSound"" = :CollisionSound, ""CollisionSoundVolume"" = :CollisionSoundVolume, ""PassTouches"" = :PassTouches,
353 ""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs, 356 ""LinkNumber"" = :LinkNumber, ""MediaURL"" = :MediaURL, ""DynAttrs"" = :DynAttrs,
354 ""PhysicsShapeType"" = :PhysicsShapeType, ""Density"" = :Density, ""GravityModifier"" = :GravityModifier, ""Friction"" = :Friction, ""Restitution"" = :Restitution 357 ""PhysInertia"" = :PhysInertia
355 WHERE ""UUID"" = :UUID ; 358 WHERE ""UUID"" = :UUID ;
356 359
357 INSERT INTO 360 INSERT INTO
358 prims ( 361 prims (
359 ""UUID"", ""CreationDate"", ""Name"", ""Text"", ""Description"", ""SitName"", ""TouchName"", ""ObjectFlags"", ""OwnerMask"", ""NextOwnerMask"", ""GroupMask"", 362 ""UUID"", ""CreationDate"", ""Name"", ""Text"", ""Description"", ""SitName"", ""TouchName"", ""ObjectFlags"", ""OwnerMask"", ""NextOwnerMask"", ""GroupMask"",
360 ""EveryoneMask"", ""BaseMask"", ""PositionX"", ""PositionY"", ""PositionZ"", ""GroupPositionX"", ""GroupPositionY"", ""GroupPositionZ"", ""VelocityX"", 363 ""EveryoneMask"", ""BaseMask"", ""PositionX"", ""PositionY"", ""PositionZ"", ""GroupPositionX"", ""GroupPositionY"", ""GroupPositionZ"", ""VelocityX"",
361 ""VelocityY"", ""VelocityZ"", ""AngularVelocityX"", ""AngularVelocityY"", ""AngularVelocityZ"", ""AccelerationX"", ""AccelerationY"", ""AccelerationZ"", 364 ""VelocityY"", ""VelocityZ"", ""AngularVelocityX"", ""AngularVelocityY"", ""AngularVelocityZ"", ""AccelerationX"", ""AccelerationY"", ""AccelerationZ"",
362 ""RotationX"", ""RotationY"", ""RotationZ"", ""RotationW"", ""SitTargetOffsetX"", ""SitTargetOffsetY"", ""SitTargetOffsetZ"", ""SitTargetOrientW"", 365 ""RotationX"", ""RotationY"", ""RotationZ"", ""RotationW"", ""SitTargetOffsetX"", ""SitTargetOffsetY"", ""SitTargetOffsetZ"", ""SitTargetOrientW"",
363 ""SitTargetOrientX"", ""SitTargetOrientY"", ""SitTargetOrientZ"", ""RegionUUID"", ""CreatorID"", ""OwnerID"", ""GroupID"", ""LastOwnerID"", ""SceneGroupID"", 366 ""SitTargetOrientX"", ""SitTargetOrientY"", ""SitTargetOrientZ"", ""RegionUUID"", ""CreatorID"", ""OwnerID"", ""GroupID"", ""LastOwnerID"", ""SceneGroupID"",
364 ""PayPrice"", ""PayButton1"", ""PayButton2"", ""PayButton3"", ""PayButton4"", ""LoopedSound"", ""LoopedSoundGain"", ""TextureAnimation"", ""OmegaX"", 367 ""PayPrice"", ""PayButton1"", ""PayButton2"", ""PayButton3"", ""PayButton4"", ""LoopedSound"", ""LoopedSoundGain"", ""TextureAnimation"", ""OmegaX"",
365 ""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"", 368 ""OmegaY"", ""OmegaZ"", ""CameraEyeOffsetX"", ""CameraEyeOffsetY"", ""CameraEyeOffsetZ"", ""CameraAtOffsetX"", ""CameraAtOffsetY"", ""CameraAtOffsetZ"",
366 ""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"", 369 ""ForceMouselook"", ""ScriptAccessPin"", ""AllowedDrop"", ""DieAtEdge"", ""SalePrice"", ""SaleType"", ""ColorR"", ""ColorG"", ""ColorB"", ""ColorA"",
367 ""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"", 370 ""ParticleSystem"", ""ClickAction"", ""Material"", ""CollisionSound"", ""CollisionSoundVolume"", ""PassTouches"", ""LinkNumber"", ""MediaURL"", ""DynAttrs"",
368 ""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"" 371 ""PhysicsShapeType"", ""Density"", ""GravityModifier"", ""Friction"", ""Restitution"", ""PassCollisions"", ""RotationAxisLocks"", ""RezzerID"" , ""PhysInertia""
369 ) Select 372 ) Select
370 :UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask, 373 :UUID, :CreationDate, :Name, :Text, :Description, :SitName, :TouchName, :ObjectFlags, :OwnerMask, :NextOwnerMask, :GroupMask,
371 :EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX, 374 :EveryoneMask, :BaseMask, :PositionX, :PositionY, :PositionZ, :GroupPositionX, :GroupPositionY, :GroupPositionZ, :VelocityX,
372 :VelocityY, :VelocityZ, :AngularVelocityX, :AngularVelocityY, :AngularVelocityZ, :AccelerationX, :AccelerationY, :AccelerationZ, 375 :VelocityY, :VelocityZ, :AngularVelocityX, :AngularVelocityY, :AngularVelocityZ, :AccelerationX, :AccelerationY, :AccelerationZ,
373 :RotationX, :RotationY, :RotationZ, :RotationW, :SitTargetOffsetX, :SitTargetOffsetY, :SitTargetOffsetZ, :SitTargetOrientW, 376 :RotationX, :RotationY, :RotationZ, :RotationW, :SitTargetOffsetX, :SitTargetOffsetY, :SitTargetOffsetZ, :SitTargetOrientW,
374 :SitTargetOrientX, :SitTargetOrientY, :SitTargetOrientZ, :RegionUUID, :CreatorID, :OwnerID, :GroupID, :LastOwnerID, :SceneGroupID, 377 :SitTargetOrientX, :SitTargetOrientY, :SitTargetOrientZ, :RegionUUID, :CreatorID, :OwnerID, :GroupID, :LastOwnerID, :SceneGroupID,
375 :PayPrice, :PayButton1, :PayButton2, :PayButton3, :PayButton4, :LoopedSound, :LoopedSoundGain, :TextureAnimation, :OmegaX, 378 :PayPrice, :PayButton1, :PayButton2, :PayButton3, :PayButton4, :LoopedSound, :LoopedSoundGain, :TextureAnimation, :OmegaX,
376 :OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ, 379 :OmegaY, :OmegaZ, :CameraEyeOffsetX, :CameraEyeOffsetY, :CameraEyeOffsetZ, :CameraAtOffsetX, :CameraAtOffsetY, :CameraAtOffsetZ,
377 :ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA, 380 :ForceMouselook, :ScriptAccessPin, :AllowedDrop, :DieAtEdge, :SalePrice, :SaleType, :ColorR, :ColorG, :ColorB, :ColorA,
378 :ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs, 381 :ParticleSystem, :ClickAction, :Material, :CollisionSound, :CollisionSoundVolume, :PassTouches, :LinkNumber, :MediaURL, :DynAttrs,
379 :PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution 382 :PhysicsShapeType, :Density, :GravityModifier, :Friction, :Restitution, :PassCollisions, :RotationAxisLocks, :RezzerID, :PhysInertia
380 where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID); 383 where not EXISTS (SELECT ""UUID"" FROM prims WHERE ""UUID"" = :UUID);
381 "; 384 ";
382 385
@@ -399,26 +402,26 @@ namespace OpenSim.Data.PGSQL
399 private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) 402 private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, NpgsqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID)
400 { 403 {
401 //Big query to or insert or update primshapes 404 //Big query to or insert or update primshapes
402 405
403 string queryPrimShapes = @" 406 string queryPrimShapes = @"
404 UPDATE primshapes SET 407 UPDATE primshapes SET
405 ""Shape"" = :Shape, ""ScaleX"" = :ScaleX, ""ScaleY"" = :ScaleY, ""ScaleZ"" = :ScaleZ, ""PCode"" = :PCode, ""PathBegin"" = :PathBegin, 408 ""Shape"" = :Shape, ""ScaleX"" = :ScaleX, ""ScaleY"" = :ScaleY, ""ScaleZ"" = :ScaleZ, ""PCode"" = :PCode, ""PathBegin"" = :PathBegin,
406 ""PathEnd"" = :PathEnd, ""PathScaleX"" = :PathScaleX, ""PathScaleY"" = :PathScaleY, ""PathShearX"" = :PathShearX, ""PathShearY"" = :PathShearY, 409 ""PathEnd"" = :PathEnd, ""PathScaleX"" = :PathScaleX, ""PathScaleY"" = :PathScaleY, ""PathShearX"" = :PathShearX, ""PathShearY"" = :PathShearY,
407 ""PathSkew"" = :PathSkew, ""PathCurve"" = :PathCurve, ""PathRadiusOffset"" = :PathRadiusOffset, ""PathRevolutions"" = :PathRevolutions, 410 ""PathSkew"" = :PathSkew, ""PathCurve"" = :PathCurve, ""PathRadiusOffset"" = :PathRadiusOffset, ""PathRevolutions"" = :PathRevolutions,
408 ""PathTaperX"" = :PathTaperX, ""PathTaperY"" = :PathTaperY, ""PathTwist"" = :PathTwist, ""PathTwistBegin"" = :PathTwistBegin, 411 ""PathTaperX"" = :PathTaperX, ""PathTaperY"" = :PathTaperY, ""PathTwist"" = :PathTwist, ""PathTwistBegin"" = :PathTwistBegin,
409 ""ProfileBegin"" = :ProfileBegin, ""ProfileEnd"" = :ProfileEnd, ""ProfileCurve"" = :ProfileCurve, ""ProfileHollow"" = :ProfileHollow, 412 ""ProfileBegin"" = :ProfileBegin, ""ProfileEnd"" = :ProfileEnd, ""ProfileCurve"" = :ProfileCurve, ""ProfileHollow"" = :ProfileHollow,
410 ""Texture"" = :Texture, ""ExtraParams"" = :ExtraParams, ""State"" = :State, ""Media"" = :Media 413 ""Texture"" = :Texture, ""ExtraParams"" = :ExtraParams, ""State"" = :State, ""Media"" = :Media
411 WHERE ""UUID"" = :UUID ; 414 WHERE ""UUID"" = :UUID ;
412 415
413 INSERT INTO 416 INSERT INTO
414 primshapes ( 417 primshapes (
415 ""UUID"", ""Shape"", ""ScaleX"", ""ScaleY"", ""ScaleZ"", ""PCode"", ""PathBegin"", ""PathEnd"", ""PathScaleX"", ""PathScaleY"", ""PathShearX"", ""PathShearY"", 418 ""UUID"", ""Shape"", ""ScaleX"", ""ScaleY"", ""ScaleZ"", ""PCode"", ""PathBegin"", ""PathEnd"", ""PathScaleX"", ""PathScaleY"", ""PathShearX"", ""PathShearY"",
416 ""PathSkew"", ""PathCurve"", ""PathRadiusOffset"", ""PathRevolutions"", ""PathTaperX"", ""PathTaperY"", ""PathTwist"", ""PathTwistBegin"", ""ProfileBegin"", 419 ""PathSkew"", ""PathCurve"", ""PathRadiusOffset"", ""PathRevolutions"", ""PathTaperX"", ""PathTaperY"", ""PathTwist"", ""PathTwistBegin"", ""ProfileBegin"",
417 ""ProfileEnd"", ""ProfileCurve"", ""ProfileHollow"", ""Texture"", ""ExtraParams"", ""State"", ""Media"" 420 ""ProfileEnd"", ""ProfileCurve"", ""ProfileHollow"", ""Texture"", ""ExtraParams"", ""State"", ""Media""
418 ) 421 )
419 Select 422 Select
420 :UUID, :Shape, :ScaleX, :ScaleY, :ScaleZ, :PCode, :PathBegin, :PathEnd, :PathScaleX, :PathScaleY, :PathShearX, :PathShearY, 423 :UUID, :Shape, :ScaleX, :ScaleY, :ScaleZ, :PCode, :PathBegin, :PathEnd, :PathScaleX, :PathScaleY, :PathShearX, :PathShearY,
421 :PathSkew, :PathCurve, :PathRadiusOffset, :PathRevolutions, :PathTaperX, :PathTaperY, :PathTwist, :PathTwistBegin, :ProfileBegin, 424 :PathSkew, :PathCurve, :PathRadiusOffset, :PathRevolutions, :PathTaperX, :PathTaperY, :PathTwist, :PathTwistBegin, :ProfileBegin,
422 :ProfileEnd, :ProfileCurve, :ProfileHollow, :Texture, :ExtraParams, :State, :Media 425 :ProfileEnd, :ProfileCurve, :ProfileHollow, :Texture, :ExtraParams, :State, :Media
423 where not EXISTS (SELECT ""UUID"" FROM primshapes WHERE ""UUID"" = :UUID); 426 where not EXISTS (SELECT ""UUID"" FROM primshapes WHERE ""UUID"" = :UUID);
424 "; 427 ";
@@ -498,7 +501,7 @@ namespace OpenSim.Data.PGSQL
498 sql = 501 sql =
499 @"INSERT INTO primitems ( 502 @"INSERT INTO primitems (
500 ""itemID"",""primID"",""assetID"",""parentFolderID"",""invType"",""assetType"",""name"",""description"",""creationDate"",""creatorID"",""ownerID"",""lastOwnerID"",""groupID"", 503 ""itemID"",""primID"",""assetID"",""parentFolderID"",""invType"",""assetType"",""name"",""description"",""creationDate"",""creatorID"",""ownerID"",""lastOwnerID"",""groupID"",
501 ""nextPermissions"",""currentPermissions"",""basePermissions"",""everyonePermissions"",""groupPermissions"",""flags"") 504 ""nextPermissions"",""currentPermissions"",""basePermissions"",""everyonePermissions"",""groupPermissions"",""flags"")
502 VALUES (:itemID,:primID,:assetID,:parentFolderID,:invType,:assetType,:name,:description,:creationDate,:creatorID,:ownerID, 505 VALUES (:itemID,:primID,:assetID,:parentFolderID,:invType,:assetType,:name,:description,:creationDate,:creatorID,:ownerID,
503 :lastOwnerID,:groupID,:nextPermissions,:currentPermissions,:basePermissions,:everyonePermissions,:groupPermissions,:flags)"; 506 :lastOwnerID,:groupID,:nextPermissions,:currentPermissions,:basePermissions,:everyonePermissions,:groupPermissions,:flags)";
504 507
@@ -536,7 +539,7 @@ namespace OpenSim.Data.PGSQL
536 { 539 {
537 TerrainData terrData = null; 540 TerrainData terrData = null;
538 541
539 string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from terrain 542 string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from terrain
540 where ""RegionUUID"" = :RegionUUID order by ""Revision"" desc limit 1; "; 543 where ""RegionUUID"" = :RegionUUID order by ""Revision"" desc limit 1; ";
541 544
542 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) 545 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
@@ -552,8 +555,11 @@ namespace OpenSim.Data.PGSQL
552 if (reader.Read()) 555 if (reader.Read())
553 { 556 {
554 rev = Convert.ToInt32(reader["Revision"]); 557 rev = Convert.ToInt32(reader["Revision"]);
555 byte[] blob = (byte[])reader["Heightfield"]; 558 if ((reader["Heightfield"] != DBNull.Value))
556 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); 559 {
560 byte[] blob = (byte[])reader["Heightfield"];
561 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
562 }
557 } 563 }
558 else 564 else
559 { 565 {
@@ -568,6 +574,39 @@ namespace OpenSim.Data.PGSQL
568 return terrData; 574 return terrData;
569 } 575 }
570 576
577 public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
578 {
579 TerrainData terrData = null;
580
581 string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain
582 where ""RegionUUID"" = :RegionUUID; ";
583
584 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
585 {
586 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
587 {
588 // PGSqlParameter param = new PGSqlParameter();
589 cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
590 conn.Open();
591 using (NpgsqlDataReader reader = cmd.ExecuteReader())
592 {
593 int rev;
594 if (reader.Read())
595 {
596 rev = Convert.ToInt32(reader["Revision"]);
597 if ((reader["Heightfield"] != DBNull.Value))
598 {
599 byte[] blob = (byte[])reader["Heightfield"];
600 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
601 }
602 }
603 }
604 }
605 }
606
607 return terrData;
608 }
609
571 // Legacy entry point for when terrain was always a 256x256 heightmap 610 // Legacy entry point for when terrain was always a 256x256 heightmap
572 public void StoreTerrain(double[,] terrain, UUID regionID) 611 public void StoreTerrain(double[,] terrain, UUID regionID)
573 { 612 {
@@ -619,6 +658,49 @@ namespace OpenSim.Data.PGSQL
619 } 658 }
620 659
621 /// <summary> 660 /// <summary>
661 /// Stores the baked terrain map to DB.
662 /// </summary>
663 /// <param name="terrain">terrain map data.</param>
664 /// <param name="regionID">regionID.</param>
665 public void StoreBakedTerrain(TerrainData terrData, UUID regionID)
666 {
667 //Delete old terrain map
668 string sql = @"delete from bakedterrain where ""RegionUUID""=:RegionUUID";
669 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
670 {
671 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
672 {
673 cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
674 conn.Open();
675 cmd.ExecuteNonQuery();
676
677 _Log.InfoFormat("{0} Deleted bakedterrain id = {1}", LogHeader, regionID);
678 }
679 }
680
681 int terrainDBRevision;
682 Array terrainDBblob;
683 terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
684
685 sql = @"insert into bakedterrain(""RegionUUID"", ""Revision"", ""Heightfield"") values(:RegionUUID, :Revision, :Heightfield)";
686
687 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
688 {
689 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
690 {
691 cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
692 cmd.Parameters.Add(_Database.CreateParameter("Revision", terrainDBRevision));
693 cmd.Parameters.Add(_Database.CreateParameter("Heightfield", terrainDBblob));
694 conn.Open();
695 cmd.ExecuteNonQuery();
696
697 _Log.InfoFormat("{0} Stored bakedterrain id = {1}, terrainSize = <{2},{3}>",
698 LogHeader, regionID, terrData.SizeX, terrData.SizeY);
699 }
700 }
701 }
702
703 /// <summary>
622 /// Loads all the land objects of a region. 704 /// Loads all the land objects of a region.
623 /// </summary> 705 /// </summary>
624 /// <param name="regionUUID">The region UUID.</param> 706 /// <param name="regionUUID">The region UUID.</param>
@@ -683,11 +765,14 @@ namespace OpenSim.Data.PGSQL
683 string sql = @"INSERT INTO land 765 string sql = @"INSERT INTO land
684 (""UUID"",""RegionUUID"",""LocalLandID"",""Bitmap"",""Name"",""Description"",""OwnerUUID"",""IsGroupOwned"",""Area"",""AuctionID"",""Category"",""ClaimDate"",""ClaimPrice"", 766 (""UUID"",""RegionUUID"",""LocalLandID"",""Bitmap"",""Name"",""Description"",""OwnerUUID"",""IsGroupOwned"",""Area"",""AuctionID"",""Category"",""ClaimDate"",""ClaimPrice"",
685 ""GroupUUID"",""SalePrice"",""LandStatus"",""LandFlags"",""LandingType"",""MediaAutoScale"",""MediaTextureUUID"",""MediaURL"",""MusicURL"",""PassHours"",""PassPrice"", 767 ""GroupUUID"",""SalePrice"",""LandStatus"",""LandFlags"",""LandingType"",""MediaAutoScale"",""MediaTextureUUID"",""MediaURL"",""MusicURL"",""PassHours"",""PassPrice"",
686 ""SnapshotUUID"",""UserLocationX"",""UserLocationY"",""UserLocationZ"",""UserLookAtX"",""UserLookAtY"",""UserLookAtZ"",""AuthbuyerID"",""OtherCleanTime"") 768 ""SnapshotUUID"",""UserLocationX"",""UserLocationY"",""UserLocationZ"",""UserLookAtX"",""UserLookAtY"",""UserLookAtZ"",""AuthbuyerID"",""OtherCleanTime"",""Dwell"",
769 ""MediaType"",""MediaDescription"",""MediaSize"",""MediaLoop"",""ObscureMusic"",""ObscureMedia"",""SeeAVs"",""AnyAVSounds"",""GroupAVSounds"")
687 VALUES 770 VALUES
688 (:UUID,:RegionUUID,:LocalLandID,:Bitmap,:Name,:Description,:OwnerUUID,:IsGroupOwned,:Area,:AuctionID,:Category,:ClaimDate,:ClaimPrice, 771 (:UUID,:RegionUUID,:LocalLandID,:Bitmap,:Name,:Description,:OwnerUUID,:IsGroupOwned,:Area,:AuctionID,:Category,:ClaimDate,:ClaimPrice,
689 :GroupUUID,:SalePrice,:LandStatus,:LandFlags,:LandingType,:MediaAutoScale,:MediaTextureUUID,:MediaURL,:MusicURL,:PassHours,:PassPrice, 772 :GroupUUID,:SalePrice,:LandStatus,:LandFlags,:LandingType,:MediaAutoScale,:MediaTextureUUID,:MediaURL,:MusicURL,:PassHours,:PassPrice,
690 :SnapshotUUID,:UserLocationX,:UserLocationY,:UserLocationZ,:UserLookAtX,:UserLookAtY,:UserLookAtZ,:AuthbuyerID,:OtherCleanTime)"; 773 :SnapshotUUID,:UserLocationX,:UserLocationY,:UserLocationZ,:UserLookAtX,:UserLookAtY,:UserLookAtZ,:AuthbuyerID,:OtherCleanTime,:Dwell,
774 :MediaType,:MediaDescription,:MediaWidth::text || ',' || :MediaHeight::text,:MediaLoop,:ObscureMusic,:ObscureMedia,:SeeAVs::int::smallint,
775 :AnyAVSounds::int::smallint,:GroupAVSounds::int::smallint)";
691 776
692 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) 777 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
693 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) 778 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
@@ -1235,7 +1320,7 @@ namespace OpenSim.Data.PGSQL
1235 { 1320 {
1236 { 1321 {
1237 string sql = "DELETE FROM regionenvironment WHERE region_id = :region_id ;"; 1322 string sql = "DELETE FROM regionenvironment WHERE region_id = :region_id ;";
1238 1323
1239 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) 1324 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
1240 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) 1325 using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
1241 { 1326 {
@@ -1336,17 +1421,17 @@ namespace OpenSim.Data.PGSQL
1336 { 1421 {
1337 //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB 1422 //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB
1338 sql = 1423 sql =
1339 @"UPDATE regionsettings SET block_terraform = :block_terraform ,block_fly = :block_fly ,allow_damage = :allow_damage 1424 @"UPDATE regionsettings SET block_terraform = :block_terraform ,block_fly = :block_fly ,allow_damage = :allow_damage
1340,restrict_pushing = :restrict_pushing ,allow_land_resell = :allow_land_resell ,allow_land_join_divide = :allow_land_join_divide 1425,restrict_pushing = :restrict_pushing ,allow_land_resell = :allow_land_resell ,allow_land_join_divide = :allow_land_join_divide
1341,block_show_in_search = :block_show_in_search ,agent_limit = :agent_limit ,object_bonus = :object_bonus ,maturity = :maturity 1426,block_show_in_search = :block_show_in_search ,agent_limit = :agent_limit ,object_bonus = :object_bonus ,maturity = :maturity
1342,disable_scripts = :disable_scripts ,disable_collisions = :disable_collisions ,disable_physics = :disable_physics 1427,disable_scripts = :disable_scripts ,disable_collisions = :disable_collisions ,disable_physics = :disable_physics
1343,terrain_texture_1 = :terrain_texture_1 ,terrain_texture_2 = :terrain_texture_2 ,terrain_texture_3 = :terrain_texture_3 1428,terrain_texture_1 = :terrain_texture_1 ,terrain_texture_2 = :terrain_texture_2 ,terrain_texture_3 = :terrain_texture_3
1344,terrain_texture_4 = :terrain_texture_4 ,elevation_1_nw = :elevation_1_nw ,elevation_2_nw = :elevation_2_nw 1429,terrain_texture_4 = :terrain_texture_4 ,elevation_1_nw = :elevation_1_nw ,elevation_2_nw = :elevation_2_nw
1345,elevation_1_ne = :elevation_1_ne ,elevation_2_ne = :elevation_2_ne ,elevation_1_se = :elevation_1_se ,elevation_2_se = :elevation_2_se 1430,elevation_1_ne = :elevation_1_ne ,elevation_2_ne = :elevation_2_ne ,elevation_1_se = :elevation_1_se ,elevation_2_se = :elevation_2_se
1346,elevation_1_sw = :elevation_1_sw ,elevation_2_sw = :elevation_2_sw ,water_height = :water_height ,terrain_raise_limit = :terrain_raise_limit 1431,elevation_1_sw = :elevation_1_sw ,elevation_2_sw = :elevation_2_sw ,water_height = :water_height ,terrain_raise_limit = :terrain_raise_limit
1347,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position 1432,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position
1348,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz, 1433,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz,
1349""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID, 1434""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID,
1350""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID 1435""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID
1351 WHERE ""regionUUID"" = :regionUUID"; 1436 WHERE ""regionUUID"" = :regionUUID";
1352 1437
@@ -1381,13 +1466,13 @@ namespace OpenSim.Data.PGSQL
1381 elevation_2_ne,elevation_1_se,elevation_2_se,elevation_1_sw,elevation_2_sw,water_height,terrain_raise_limit, 1466 elevation_2_ne,elevation_1_se,elevation_2_se,elevation_1_sw,elevation_2_sw,water_height,terrain_raise_limit,
1382 terrain_lower_limit,use_estate_sun,fixed_sun,sun_position,covenant,covenant_datetime,sunvectorx, sunvectory, sunvectorz, 1467 terrain_lower_limit,use_estate_sun,fixed_sun,sun_position,covenant,covenant_datetime,sunvectorx, sunvectory, sunvectorz,
1383 ""Sandbox"", loaded_creation_datetime, loaded_creation_id 1468 ""Sandbox"", loaded_creation_datetime, loaded_creation_id
1384 ) 1469 )
1385 VALUES 1470 VALUES
1386 (:regionUUID,:block_terraform,:block_fly,:allow_damage,:restrict_pushing,:allow_land_resell,:allow_land_join_divide, 1471 (:regionUUID,:block_terraform,:block_fly,:allow_damage,:restrict_pushing,:allow_land_resell,:allow_land_join_divide,
1387 :block_show_in_search,:agent_limit,:object_bonus,:maturity,:disable_scripts,:disable_collisions,:disable_physics, 1472 :block_show_in_search,:agent_limit,:object_bonus,:maturity,:disable_scripts,:disable_collisions,:disable_physics,
1388 :terrain_texture_1,:terrain_texture_2,:terrain_texture_3,:terrain_texture_4,:elevation_1_nw,:elevation_2_nw,:elevation_1_ne, 1473 :terrain_texture_1,:terrain_texture_2,:terrain_texture_3,:terrain_texture_4,:elevation_1_nw,:elevation_2_nw,:elevation_1_ne,
1389 :elevation_2_ne,:elevation_1_se,:elevation_2_se,:elevation_1_sw,:elevation_2_sw,:water_height,:terrain_raise_limit, 1474 :elevation_2_ne,:elevation_1_se,:elevation_2_se,:elevation_1_sw,:elevation_2_sw,:water_height,:terrain_raise_limit,
1390 :terrain_lower_limit,:use_estate_sun,:fixed_sun,:sun_position,:covenant, :covenant_datetime, :sunvectorx,:sunvectory, 1475 :terrain_lower_limit,:use_estate_sun,:fixed_sun,:sun_position,:covenant, :covenant_datetime, :sunvectorx,:sunvectory,
1391 :sunvectorz, :Sandbox, :loaded_creation_datetime, :loaded_creation_id )"; 1476 :sunvectorz, :Sandbox, :loaded_creation_datetime, :loaded_creation_id )";
1392 1477
1393 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) 1478 using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
@@ -1515,6 +1600,8 @@ namespace OpenSim.Data.PGSQL
1515 newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); 1600 newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]);
1516 1601
1517 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); 1602 newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]);
1603 newData.Dwell = Convert.ToSingle(row["Dwell"]);
1604
1518 1605
1519 try 1606 try
1520 { 1607 {
@@ -1541,6 +1628,10 @@ namespace OpenSim.Data.PGSQL
1541 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); 1628 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
1542 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); 1629 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
1543 1630
1631 newData.SeeAVs = Convert.ToBoolean(row["SeeAVs"]);
1632 newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]);
1633 newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]);
1634
1544 return newData; 1635 return newData;
1545 } 1636 }
1546 1637
@@ -1588,6 +1679,12 @@ namespace OpenSim.Data.PGSQL
1588 prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); 1679 prim.OwnerID = new UUID((Guid)primRow["OwnerID"]);
1589 prim.GroupID = new UUID((Guid)primRow["GroupID"]); 1680 prim.GroupID = new UUID((Guid)primRow["GroupID"]);
1590 prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); 1681 prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]);
1682
1683 if (primRow["RezzerID"] != DBNull.Value)
1684 prim.RezzerID = new UUID((Guid)primRow["RezzerID"]);
1685 else
1686 prim.RezzerID = UUID.Zero;
1687
1591 prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]); 1688 prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]);
1592 prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]); 1689 prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]);
1593 prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]); 1690 prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]);
@@ -1692,6 +1789,7 @@ namespace OpenSim.Data.PGSQL
1692 prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]); 1789 prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
1693 1790
1694 prim.PassTouches = (bool)primRow["PassTouches"]; 1791 prim.PassTouches = (bool)primRow["PassTouches"];
1792 prim.PassCollisions = (bool)primRow["PassCollisions"];
1695 1793
1696 if (!(primRow["MediaURL"] is System.DBNull)) 1794 if (!(primRow["MediaURL"] is System.DBNull))
1697 prim.MediaUrl = (string)primRow["MediaURL"]; 1795 prim.MediaUrl = (string)primRow["MediaURL"];
@@ -1699,13 +1797,20 @@ namespace OpenSim.Data.PGSQL
1699 if (!(primRow["DynAttrs"] is System.DBNull) && (string)primRow["DynAttrs"] != "") 1797 if (!(primRow["DynAttrs"] is System.DBNull) && (string)primRow["DynAttrs"] != "")
1700 prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]); 1798 prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]);
1701 else 1799 else
1702 prim.DynAttrs = new DAMap(); 1800 prim.DynAttrs = new DAMap();
1703 1801
1704 prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]); 1802 prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]);
1705 prim.Density = Convert.ToSingle(primRow["Density"]); 1803 prim.Density = Convert.ToSingle(primRow["Density"]);
1706 prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]); 1804 prim.GravityModifier = Convert.ToSingle(primRow["GravityModifier"]);
1707 prim.Friction = Convert.ToSingle(primRow["Friction"]); 1805 prim.Friction = Convert.ToSingle(primRow["Friction"]);
1708 prim.Restitution = Convert.ToSingle(primRow["Restitution"]); 1806 prim.Restitution = Convert.ToSingle(primRow["Restitution"]);
1807 prim.RotationAxisLocks = Convert.ToByte(primRow["RotationAxisLocks"]);
1808
1809
1810 PhysicsInertiaData pdata = null;
1811 if (!(primRow["PhysInertia"] is System.DBNull))
1812 pdata = PhysicsInertiaData.FromXml2(primRow["PhysInertia"].ToString());
1813 prim.PhysicsInertia = pdata;
1709 1814
1710 return prim; 1815 return prim;
1711 } 1816 }
@@ -1942,6 +2047,17 @@ namespace OpenSim.Data.PGSQL
1942 parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); 2047 parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z));
1943 parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); 2048 parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID));
1944 parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); 2049 parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime));
2050 parameters.Add(_Database.CreateParameter("Dwell", land.Dwell));
2051 parameters.Add(_Database.CreateParameter("MediaDescription", land.MediaDescription));
2052 parameters.Add(_Database.CreateParameter("MediaType", land.MediaType));
2053 parameters.Add(_Database.CreateParameter("MediaWidth", land.MediaWidth));
2054 parameters.Add(_Database.CreateParameter("MediaHeight", land.MediaHeight));
2055 parameters.Add(_Database.CreateParameter("MediaLoop", land.MediaLoop));
2056 parameters.Add(_Database.CreateParameter("ObscureMusic", land.ObscureMusic));
2057 parameters.Add(_Database.CreateParameter("ObscureMedia", land.ObscureMedia));
2058 parameters.Add(_Database.CreateParameter("SeeAVs", land.SeeAVs));
2059 parameters.Add(_Database.CreateParameter("AnyAVSounds", land.AnyAVSounds));
2060 parameters.Add(_Database.CreateParameter("GroupAVSounds", land.GroupAVSounds));
1945 2061
1946 return parameters.ToArray(); 2062 return parameters.ToArray();
1947 } 2063 }
@@ -1996,6 +2112,7 @@ namespace OpenSim.Data.PGSQL
1996 parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID)); 2112 parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID));
1997 parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID)); 2113 parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID));
1998 parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID)); 2114 parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID));
2115 parameters.Add(_Database.CreateParameter("RezzerID", prim.RezzerID));
1999 parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask)); 2116 parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask));
2000 parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask)); 2117 parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask));
2001 parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask)); 2118 parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask));
@@ -2094,28 +2211,47 @@ namespace OpenSim.Data.PGSQL
2094 2211
2095 parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); 2212 parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound));
2096 parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); 2213 parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
2214
2215 parameters.Add(_Database.CreateParameter("PassTouches", (bool)prim.PassTouches));
2216 parameters.Add(_Database.CreateParameter("PassCollisions", (bool)prim.PassCollisions));
2217
2097 2218
2098 parameters.Add(_Database.CreateParameter("PassTouches", prim.PassTouches)); 2219 if (prim.PassTouches)
2220 parameters.Add(_Database.CreateParameter("PassTouches", true));
2221 else
2222 parameters.Add(_Database.CreateParameter("PassTouches", false));
2223
2224 if (prim.PassCollisions)
2225 parameters.Add(_Database.CreateParameter("PassCollisions", true));
2226 else
2227 parameters.Add(_Database.CreateParameter("PassCollisions", false));
2099 2228
2100 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); 2229 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
2101 parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); 2230 parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
2102 2231
2232 if (prim.PhysicsInertia != null)
2233 parameters.Add(_Database.CreateParameter("PhysInertia", prim.PhysicsInertia.ToXml2()));
2234 else
2235 parameters.Add(_Database.CreateParameter("PhysInertia", String.Empty));
2236
2237
2103 if (prim.DynAttrs.CountNamespaces > 0) 2238 if (prim.DynAttrs.CountNamespaces > 0)
2104 parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml())); 2239 parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
2105 else 2240 else
2106 parameters.Add(_Database.CreateParameter("DynAttrs", null)); 2241 parameters.Add(_Database.CreateParameter("DynAttrs", null));
2107 2242
2108 parameters.Add(_Database.CreateParameter("PhysicsShapeType", prim.PhysicsShapeType)); 2243 parameters.Add(_Database.CreateParameter("PhysicsShapeType", prim.PhysicsShapeType));
2109 parameters.Add(_Database.CreateParameter("Density", (double)prim.Density)); 2244 parameters.Add(_Database.CreateParameter("Density", (double)prim.Density));
2110 parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier)); 2245 parameters.Add(_Database.CreateParameter("GravityModifier", (double)prim.GravityModifier));
2111 parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction)); 2246 parameters.Add(_Database.CreateParameter("Friction", (double)prim.Friction));
2112 parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution)); 2247 parameters.Add(_Database.CreateParameter("Restitution", (double)prim.Restitution));
2248 parameters.Add(_Database.CreateParameter("RotationAxisLocks", prim.RotationAxisLocks));
2113 2249
2114 return parameters.ToArray(); 2250 return parameters.ToArray();
2115 } 2251 }
2116 2252
2117 /// <summary> 2253 /// <summary>
2118 /// Creates the primshape parameters for stroing in DB. 2254 /// Creates the primshape parameters for storing in DB.
2119 /// </summary> 2255 /// </summary>
2120 /// <param name="prim">Basic data of SceneObjectpart prim.</param> 2256 /// <param name="prim">Basic data of SceneObjectpart prim.</param>
2121 /// <param name="sceneGroupID">The scene group ID.</param> 2257 /// <param name="sceneGroupID">The scene group ID.</param>
@@ -2227,6 +2363,11 @@ namespace OpenSim.Data.PGSQL
2227 } 2363 }
2228 } 2364 }
2229 2365
2366 public UUID[] GetObjectIDs(UUID regionID)
2367 {
2368 return new UUID[0];
2369 }
2370
2230 public void SaveExtra(UUID regionID, string name, string value) 2371 public void SaveExtra(UUID regionID, string name, string value)
2231 { 2372 {
2232 } 2373 }