PGSQL: Convert PassCollision in table prims to bool to avoid a hopeless cast that fails with newer versions of NPGSQL.

Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
0.9.0-post-fixes
Geir Nøklebye 2017-05-13 17:43:59 +01:00 committed by UbitUmarov
parent 16f02cb6fd
commit 7cf82a71d6
2 changed files with 18 additions and 3 deletions

View File

@ -1789,6 +1789,7 @@ namespace OpenSim.Data.PGSQL
prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]); prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]);
prim.PassTouches = (bool)primRow["PassTouches"]; prim.PassTouches = (bool)primRow["PassTouches"];
prim.PassCollisions = (bool)primRow["PassCollisions"];
if (!(primRow["MediaURL"] is System.DBNull)) if (!(primRow["MediaURL"] is System.DBNull))
prim.MediaUrl = (string)primRow["MediaURL"]; prim.MediaUrl = (string)primRow["MediaURL"];
@ -2212,7 +2213,7 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume));
parameters.Add(_Database.CreateParameter("PassTouches", (bool)prim.PassTouches)); parameters.Add(_Database.CreateParameter("PassTouches", (bool)prim.PassTouches));
parameters.Add(_Database.CreateParameter("PassCollisions", prim.PassCollisions)); parameters.Add(_Database.CreateParameter("PassCollisions", (bool)prim.PassCollisions));
if (prim.PassTouches) if (prim.PassTouches)
@ -2221,9 +2222,9 @@ namespace OpenSim.Data.PGSQL
parameters.Add(_Database.CreateParameter("PassTouches", false)); parameters.Add(_Database.CreateParameter("PassTouches", false));
if (prim.PassCollisions) if (prim.PassCollisions)
parameters.Add(_Database.CreateParameter("PassCollisions", 1)); parameters.Add(_Database.CreateParameter("PassCollisions", false));
else else
parameters.Add(_Database.CreateParameter("PassCollisions", 0)); parameters.Add(_Database.CreateParameter("PassCollisions", true));
parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));

View File

@ -1211,3 +1211,17 @@ BEGIN TRANSACTION;
ALTER TABLE prims ADD "PhysInertia" TEXT; ALTER TABLE prims ADD "PhysInertia" TEXT;
COMMIT; COMMIT;
:VERSION 47 #---- Convert field PassCollisions in table prims to BOOLEAN
BEGIN TRANSACTION;
ALTER TABLE "public"."prims" ALTER COLUMN "PassCollisions" DROP DEFAULT;
ALTER TABLE "public"."prims"
ALTER COLUMN "PassCollisions" TYPE BOOLEAN
USING CASE WHEN "PassCollisions" = 0 THEN FALSE
WHEN "PassCollisions" = 1 THEN TRUE
ELSE NULL
END;
COMMIT;