aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorGeir Nøklebye2016-07-15 16:34:32 +0200
committerUbitUmarov2016-07-15 15:45:39 +0100
commit653b896794d884dbdb44dace81d3cf99a93c7705 (patch)
treee055e0e5375e5cb914a7a1613d0d942c0bc3a52e /OpenSim
parentlib omv now supports SeeAvs fields, so use it, thx Gavin Hird (diff)
downloadopensim-SC_OLD-653b896794d884dbdb44dace81d3cf99a93c7705.zip
opensim-SC_OLD-653b896794d884dbdb44dace81d3cf99a93c7705.tar.gz
opensim-SC_OLD-653b896794d884dbdb44dace81d3cf99a93c7705.tar.bz2
opensim-SC_OLD-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 'OpenSim')
-rw-r--r--OpenSim/Data/PGSQL/PGSQLRegionData.cs6
-rwxr-xr-xOpenSim/Data/PGSQL/PGSQLSimulationData.cs24
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
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Data; 31using System.Data;
31using System.Drawing;
32using System.IO;
33using System.Reflection; 32using System.Reflection;
34using log4net; 33using log4net;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Data;
38using OpenSim.Region.Framework.Scenes;
39using RegionFlags = OpenSim.Framework.RegionFlags; 37using RegionFlags = OpenSim.Framework.RegionFlags;
40using Npgsql; 38using 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 }