diff options
author | Geir Nøklebye | 2016-07-15 16:34:32 +0200 |
---|---|---|
committer | UbitUmarov | 2016-07-15 15:45:39 +0100 |
commit | 653b896794d884dbdb44dace81d3cf99a93c7705 (patch) | |
tree | e055e0e5375e5cb914a7a1613d0d942c0bc3a52e | |
parent | lib omv now supports SeeAvs fields, so use it, thx Gavin Hird (diff) | |
download | opensim-SC-653b896794d884dbdb44dace81d3cf99a93c7705.zip opensim-SC-653b896794d884dbdb44dace81d3cf99a93c7705.tar.gz opensim-SC-653b896794d884dbdb44dace81d3cf99a93c7705.tar.bz2 opensim-SC-653b896794d884dbdb44dace81d3cf99a93c7705.tar.xz |
PGSQL: Update simulation data with a number of missing fields for parcels. Some of the fields should probably be migrated to type Boolean to avoid the hairy casting in the query. In addition the overall server code relies in the Replace in SQL statement that is proprietary to MySQL, so the PGSQL code is rather unsafe as it is. Should probably set a transaction on the whole operation so that if something goes wrong the database record is not zapped as it is now. PostgreSQL 9.5 has the upsert functionality which would bring the code closer to the MySQL version. This commit also has an update to PGSQLRegionData
Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/PGSQL/PGSQLRegionData.cs | 6 | ||||
-rwxr-xr-x | OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 24 |
2 files changed, 24 insertions, 6 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLRegionData.cs b/OpenSim/Data/PGSQL/PGSQLRegionData.cs index a7da013..3924b7b 100644 --- a/OpenSim/Data/PGSQL/PGSQLRegionData.cs +++ b/OpenSim/Data/PGSQL/PGSQLRegionData.cs | |||
@@ -26,16 +26,14 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Data; | 31 | using System.Data; |
31 | using System.Drawing; | ||
32 | using System.IO; | ||
33 | using System.Reflection; | 32 | using System.Reflection; |
34 | using log4net; | 33 | using log4net; |
35 | using OpenMetaverse; | 34 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
37 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Data; |
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | using RegionFlags = OpenSim.Framework.RegionFlags; | 37 | using RegionFlags = OpenSim.Framework.RegionFlags; |
40 | using Npgsql; | 38 | using Npgsql; |
41 | 39 | ||
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index 960e7f6..25e1a7f 100755 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs | |||
@@ -688,11 +688,14 @@ namespace OpenSim.Data.PGSQL | |||
688 | string sql = @"INSERT INTO land | 688 | string sql = @"INSERT INTO land |
689 | (""UUID"",""RegionUUID"",""LocalLandID"",""Bitmap"",""Name"",""Description"",""OwnerUUID"",""IsGroupOwned"",""Area"",""AuctionID"",""Category"",""ClaimDate"",""ClaimPrice"", | 689 | (""UUID"",""RegionUUID"",""LocalLandID"",""Bitmap"",""Name"",""Description"",""OwnerUUID"",""IsGroupOwned"",""Area"",""AuctionID"",""Category"",""ClaimDate"",""ClaimPrice"", |
690 | ""GroupUUID"",""SalePrice"",""LandStatus"",""LandFlags"",""LandingType"",""MediaAutoScale"",""MediaTextureUUID"",""MediaURL"",""MusicURL"",""PassHours"",""PassPrice"", | 690 | ""GroupUUID"",""SalePrice"",""LandStatus"",""LandFlags"",""LandingType"",""MediaAutoScale"",""MediaTextureUUID"",""MediaURL"",""MusicURL"",""PassHours"",""PassPrice"", |
691 | ""SnapshotUUID"",""UserLocationX"",""UserLocationY"",""UserLocationZ"",""UserLookAtX"",""UserLookAtY"",""UserLookAtZ"",""AuthbuyerID"",""OtherCleanTime"") | 691 | ""SnapshotUUID"",""UserLocationX"",""UserLocationY"",""UserLocationZ"",""UserLookAtX"",""UserLookAtY"",""UserLookAtZ"",""AuthbuyerID"",""OtherCleanTime"",""Dwell"", |
692 | ""MediaType"",""MediaDescription"",""MediaSize"",""MediaLoop"",""ObscureMusic"",""ObscureMedia"",""SeeAVs"",""AnyAVSounds"",""GroupAVSounds"") | ||
692 | VALUES | 693 | VALUES |
693 | (:UUID,:RegionUUID,:LocalLandID,:Bitmap,:Name,:Description,:OwnerUUID,:IsGroupOwned,:Area,:AuctionID,:Category,:ClaimDate,:ClaimPrice, | 694 | (:UUID,:RegionUUID,:LocalLandID,:Bitmap,:Name,:Description,:OwnerUUID,:IsGroupOwned,:Area,:AuctionID,:Category,:ClaimDate,:ClaimPrice, |
694 | :GroupUUID,:SalePrice,:LandStatus,:LandFlags,:LandingType,:MediaAutoScale,:MediaTextureUUID,:MediaURL,:MusicURL,:PassHours,:PassPrice, | 695 | :GroupUUID,:SalePrice,:LandStatus,:LandFlags,:LandingType,:MediaAutoScale,:MediaTextureUUID,:MediaURL,:MusicURL,:PassHours,:PassPrice, |
695 | :SnapshotUUID,:UserLocationX,:UserLocationY,:UserLocationZ,:UserLookAtX,:UserLookAtY,:UserLookAtZ,:AuthbuyerID,:OtherCleanTime)"; | 696 | :SnapshotUUID,:UserLocationX,:UserLocationY,:UserLocationZ,:UserLookAtX,:UserLookAtY,:UserLookAtZ,:AuthbuyerID,:OtherCleanTime,:Dwell, |
697 | :MediaType,:MediaDescription,:MediaWidth::text || ',' || :MediaHeight::text,:MediaLoop,:ObscureMusic,:ObscureMedia,:SeeAVs::int::smallint, | ||
698 | :AnyAVSounds::int::smallint,:GroupAVSounds::int::smallint)"; | ||
696 | 699 | ||
697 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) | 700 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) |
698 | using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) | 701 | using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) |
@@ -1520,6 +1523,8 @@ namespace OpenSim.Data.PGSQL | |||
1520 | newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); | 1523 | newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); |
1521 | 1524 | ||
1522 | newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); | 1525 | newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); |
1526 | newData.Dwell = Convert.ToSingle(row["Dwell"]); | ||
1527 | |||
1523 | 1528 | ||
1524 | try | 1529 | try |
1525 | { | 1530 | { |
@@ -1545,6 +1550,10 @@ namespace OpenSim.Data.PGSQL | |||
1545 | newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); | 1550 | newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); |
1546 | newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); | 1551 | newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); |
1547 | newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); | 1552 | newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); |
1553 | |||
1554 | newData.SeeAVs = Convert.ToBoolean(row["SeeAVs"]); | ||
1555 | newData.AnyAVSounds = Convert.ToBoolean(row["AnyAVSounds"]); | ||
1556 | newData.GroupAVSounds = Convert.ToBoolean(row["GroupAVSounds"]); | ||
1548 | 1557 | ||
1549 | return newData; | 1558 | return newData; |
1550 | } | 1559 | } |
@@ -1947,6 +1956,17 @@ namespace OpenSim.Data.PGSQL | |||
1947 | parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); | 1956 | parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); |
1948 | parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); | 1957 | parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); |
1949 | parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); | 1958 | parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); |
1959 | parameters.Add(_Database.CreateParameter("Dwell", land.Dwell)); | ||
1960 | parameters.Add(_Database.CreateParameter("MediaDescription", land.MediaDescription)); | ||
1961 | parameters.Add(_Database.CreateParameter("MediaType", land.MediaType)); | ||
1962 | parameters.Add(_Database.CreateParameter("MediaWidth", land.MediaWidth)); | ||
1963 | parameters.Add(_Database.CreateParameter("MediaHeight", land.MediaHeight)); | ||
1964 | parameters.Add(_Database.CreateParameter("MediaLoop", land.MediaLoop)); | ||
1965 | parameters.Add(_Database.CreateParameter("ObscureMusic", land.ObscureMusic)); | ||
1966 | parameters.Add(_Database.CreateParameter("ObscureMedia", land.ObscureMedia)); | ||
1967 | parameters.Add(_Database.CreateParameter("SeeAVs", land.SeeAVs)); | ||
1968 | parameters.Add(_Database.CreateParameter("AnyAVSounds", land.AnyAVSounds)); | ||
1969 | parameters.Add(_Database.CreateParameter("GroupAVSounds", land.GroupAVSounds)); | ||
1950 | 1970 | ||
1951 | return parameters.ToArray(); | 1971 | return parameters.ToArray(); |
1952 | } | 1972 | } |