From b7750e52d6a1db6ef8bec377243cb6bf851fb937 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 24 Jun 2020 11:36:34 +0100 Subject: [PATCH] lang env on PGSQL --- OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 49 +++++++++++++++++-- .../PGSQL/Resources/RegionStore.migrations | 5 ++ 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index e65576fbc5..82f742fafa 100755 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs @@ -770,13 +770,14 @@ namespace OpenSim.Data.PGSQL (""UUID"",""RegionUUID"",""LocalLandID"",""Bitmap"",""Name"",""Description"",""OwnerUUID"",""IsGroupOwned"",""Area"",""AuctionID"",""Category"",""ClaimDate"",""ClaimPrice"", ""GroupUUID"",""SalePrice"",""LandStatus"",""LandFlags"",""LandingType"",""MediaAutoScale"",""MediaTextureUUID"",""MediaURL"",""MusicURL"",""PassHours"",""PassPrice"", ""SnapshotUUID"",""UserLocationX"",""UserLocationY"",""UserLocationZ"",""UserLookAtX"",""UserLookAtY"",""UserLookAtZ"",""AuthbuyerID"",""OtherCleanTime"",""Dwell"", - ""MediaType"",""MediaDescription"",""MediaSize"",""MediaLoop"",""ObscureMusic"",""ObscureMedia"",""SeeAVs"",""AnyAVSounds"",""GroupAVSounds"") + ""MediaType"",""MediaDescription"",""MediaSize"",""MediaLoop"",""ObscureMusic"",""ObscureMedia"",""SeeAVs"",""AnyAVSounds"",""GroupAVSounds"", + ""environment"") VALUES (:UUID,:RegionUUID,:LocalLandID,:Bitmap,:Name,:Description,:OwnerUUID,:IsGroupOwned,:Area,:AuctionID,:Category,:ClaimDate,:ClaimPrice, :GroupUUID,:SalePrice,:LandStatus,:LandFlags,:LandingType,:MediaAutoScale,:MediaTextureUUID,:MediaURL,:MusicURL,:PassHours,:PassPrice, :SnapshotUUID,:UserLocationX,:UserLocationY,:UserLocationZ,:UserLookAtX,:UserLookAtY,:UserLookAtZ,:AuthbuyerID,:OtherCleanTime,:Dwell, :MediaType,:MediaDescription,:MediaWidth::text || ',' || :MediaHeight::text,:MediaLoop,:ObscureMusic,:ObscureMedia,:SeeAVs::int::smallint, - :AnyAVSounds::int::smallint,:GroupAVSounds::int::smallint)"; + :AnyAVSounds::int::smallint,:GroupAVSounds::int::smallint,:environment)"; using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) @@ -1137,7 +1138,6 @@ namespace OpenSim.Data.PGSQL newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); newData.Dwell = Convert.ToSingle(row["Dwell"]); - try { newData.UserLocation = @@ -1167,6 +1167,35 @@ namespace OpenSim.Data.PGSQL newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]); newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]); + if (row["environment"] is DBNull) + { + newData.Environment = null; + newData.EnvironmentVersion = -1; + } + else + { + string env = (string)row["environment"]; + if (string.IsNullOrEmpty(env)) + { + newData.Environment = null; + newData.EnvironmentVersion = -1; + } + else + { + try + { + ViewerEnvironment VEnv = ViewerEnvironment.FromOSDString(env); + newData.Environment = VEnv; + newData.EnvironmentVersion = VEnv.version; + } + catch + { + newData.Environment = null; + newData.EnvironmentVersion = -1; + } + } + } + return newData; } @@ -1618,6 +1647,20 @@ namespace OpenSim.Data.PGSQL parameters.Add(_Database.CreateParameter("AnyAVSounds", land.AnyAVSounds)); parameters.Add(_Database.CreateParameter("GroupAVSounds", land.GroupAVSounds)); + if (land.Environment == null) + parameters.Add(_Database.CreateParameter("environment", "")); + else + { + try + { + parameters.Add(_Database.CreateParameter("environment", ViewerEnvironment.ToOSDString(land.Environment))); + } + catch + { + parameters.Add(_Database.CreateParameter("environment", "")); + } + } + return parameters.ToArray(); } diff --git a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations index 1332cb8b15..e267345420 100644 --- a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations @@ -1250,3 +1250,8 @@ BEGIN; ALTER TABLE `prims` ADD COLUMN `pseudocrc` integer DEFAULT '0'; ALTER TABLE `regionsettings` ADD COLUMN `cacheID` uuid DEFAULT NULL; COMMIT; + +:VERSION 51 #----- parcel environment store +BEGIN; +ALTER TABLE `land` ADD COLUMN `environment` varchar default NULL; +COMMIT; \ No newline at end of file