diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 47 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/RegionStore.migrations | 11 | ||||
-rw-r--r-- | OpenSim/Data/Null/NullSimulationData.cs | 8 | ||||
-rwxr-xr-x | OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 43 | ||||
-rw-r--r-- | OpenSim/Data/PGSQL/Resources/RegionStore.migrations | 13 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/Resources/RegionStore.migrations | 11 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteSimulationData.cs | 53 |
7 files changed, 175 insertions, 11 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 46364a5..1a57199 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -639,6 +639,53 @@ namespace OpenSim.Data.MySQL | |||
639 | }); | 639 | }); |
640 | } | 640 | } |
641 | 641 | ||
642 | public void StoreBakedTerrain(TerrainData terrData, UUID regionID) | ||
643 | { | ||
644 | Util.FireAndForget(delegate(object x) | ||
645 | { | ||
646 | m_log.Info("[REGION DB]: Storing Baked terrain"); | ||
647 | |||
648 | lock (m_dbLock) | ||
649 | { | ||
650 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
651 | { | ||
652 | dbcon.Open(); | ||
653 | |||
654 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
655 | { | ||
656 | cmd.CommandText = "delete from bakedterrain where RegionUUID = ?RegionUUID"; | ||
657 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
658 | |||
659 | using (MySqlCommand cmd2 = dbcon.CreateCommand()) | ||
660 | { | ||
661 | try | ||
662 | { | ||
663 | cmd2.CommandText = "insert into bakedterrain (RegionUUID, " + | ||
664 | "Revision, Heightfield) values (?RegionUUID, " + | ||
665 | "?Revision, ?Heightfield)"; | ||
666 | |||
667 | int terrainDBRevision; | ||
668 | Array terrainDBblob; | ||
669 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | ||
670 | |||
671 | cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
672 | cmd2.Parameters.AddWithValue("Revision", terrainDBRevision); | ||
673 | cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob); | ||
674 | |||
675 | ExecuteNonQuery(cmd); | ||
676 | ExecuteNonQuery(cmd2); | ||
677 | } | ||
678 | catch (Exception e) | ||
679 | { | ||
680 | m_log.ErrorFormat(e.ToString()); | ||
681 | } | ||
682 | } | ||
683 | } | ||
684 | } | ||
685 | } | ||
686 | }); | ||
687 | } | ||
688 | |||
642 | // Legacy region loading | 689 | // Legacy region loading |
643 | public virtual double[,] LoadTerrain(UUID regionID) | 690 | public virtual double[,] LoadTerrain(UUID regionID) |
644 | { | 691 | { |
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index c32f645..1de5a01 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations | |||
@@ -379,3 +379,14 @@ ALTER TABLE `prims` ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default ' | |||
379 | 379 | ||
380 | COMMIT; | 380 | COMMIT; |
381 | 381 | ||
382 | :VERSION 54 #----- add baked terrain store | ||
383 | |||
384 | BEGIN; | ||
385 | |||
386 | CREATE TABLE IF NOT EXISTS `bakedterrain` ( | ||
387 | `RegionUUID` varchar(255) DEFAULT NULL, | ||
388 | `Revision` int(11) DEFAULT NULL, | ||
389 | `Heightfield` longblob | ||
390 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
391 | |||
392 | COMMIT; | ||
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index 339e7f4..5ea8bfa 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs | |||
@@ -133,6 +133,7 @@ namespace OpenSim.Data.Null | |||
133 | } | 133 | } |
134 | 134 | ||
135 | Dictionary<UUID, TerrainData> m_terrains = new Dictionary<UUID, TerrainData>(); | 135 | Dictionary<UUID, TerrainData> m_terrains = new Dictionary<UUID, TerrainData>(); |
136 | Dictionary<UUID, TerrainData> m_bakedterrains = new Dictionary<UUID, TerrainData>(); | ||
136 | public void StoreTerrain(TerrainData ter, UUID regionID) | 137 | public void StoreTerrain(TerrainData ter, UUID regionID) |
137 | { | 138 | { |
138 | if (m_terrains.ContainsKey(regionID)) | 139 | if (m_terrains.ContainsKey(regionID)) |
@@ -140,6 +141,13 @@ namespace OpenSim.Data.Null | |||
140 | m_terrains.Add(regionID, ter); | 141 | m_terrains.Add(regionID, ter); |
141 | } | 142 | } |
142 | 143 | ||
144 | public void StoreBakedTerrain(TerrainData ter, UUID regionID) | ||
145 | { | ||
146 | if (m_bakedterrains.ContainsKey(regionID)) | ||
147 | m_bakedterrains.Remove(regionID); | ||
148 | m_bakedterrains.Add(regionID, ter); | ||
149 | } | ||
150 | |||
143 | // Legacy. Just don't do this. | 151 | // Legacy. Just don't do this. |
144 | public void StoreTerrain(double[,] ter, UUID regionID) | 152 | public void StoreTerrain(double[,] ter, UUID regionID) |
145 | { | 153 | { |
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index 25e1a7f..e6161a2 100755 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs | |||
@@ -624,6 +624,49 @@ namespace OpenSim.Data.PGSQL | |||
624 | } | 624 | } |
625 | 625 | ||
626 | /// <summary> | 626 | /// <summary> |
627 | /// Stores the baked terrain map to DB. | ||
628 | /// </summary> | ||
629 | /// <param name="terrain">terrain map data.</param> | ||
630 | /// <param name="regionID">regionID.</param> | ||
631 | public void StoreBakedTerrain(TerrainData terrData, UUID regionID) | ||
632 | { | ||
633 | //Delete old terrain map | ||
634 | string sql = @"delete from bakedterrain where ""RegionUUID""=:RegionUUID"; | ||
635 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) | ||
636 | { | ||
637 | using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) | ||
638 | { | ||
639 | cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID)); | ||
640 | conn.Open(); | ||
641 | cmd.ExecuteNonQuery(); | ||
642 | |||
643 | _Log.InfoFormat("{0} Deleted bakedterrain id = {1}", LogHeader, regionID); | ||
644 | } | ||
645 | } | ||
646 | |||
647 | int terrainDBRevision; | ||
648 | Array terrainDBblob; | ||
649 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | ||
650 | |||
651 | sql = @"insert into bakedterrain(""RegionUUID"", ""Revision"", ""Heightfield"") values(:RegionUUID, :Revision, :Heightfield)"; | ||
652 | |||
653 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) | ||
654 | { | ||
655 | using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) | ||
656 | { | ||
657 | cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID)); | ||
658 | cmd.Parameters.Add(_Database.CreateParameter("Revision", terrainDBRevision)); | ||
659 | cmd.Parameters.Add(_Database.CreateParameter("Heightfield", terrainDBblob)); | ||
660 | conn.Open(); | ||
661 | cmd.ExecuteNonQuery(); | ||
662 | |||
663 | _Log.InfoFormat("{0} Stored bakedterrain id = {1}, terrainSize = <{2},{3}>", | ||
664 | LogHeader, regionID, terrData.SizeX, terrData.SizeY); | ||
665 | } | ||
666 | } | ||
667 | } | ||
668 | |||
669 | /// <summary> | ||
627 | /// Loads all the land objects of a region. | 670 | /// Loads all the land objects of a region. |
628 | /// </summary> | 671 | /// </summary> |
629 | /// <param name="regionUUID">The region UUID.</param> | 672 | /// <param name="regionUUID">The region UUID.</param> |
diff --git a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations index 9a2c19b..c085939 100644 --- a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations | |||
@@ -1182,3 +1182,16 @@ BEGIN TRANSACTION; | |||
1182 | ALTER TABLE prims ADD "RotationAxisLocks" smallint NOT NULL DEFAULT (0); | 1182 | ALTER TABLE prims ADD "RotationAxisLocks" smallint NOT NULL DEFAULT (0); |
1183 | 1183 | ||
1184 | COMMIT; | 1184 | COMMIT; |
1185 | |||
1186 | :VERSION 44 #---- add baked terrain store | ||
1187 | |||
1188 | BEGIN TRANSACTION; | ||
1189 | |||
1190 | CREATE TABLE bakedterrain | ||
1191 | ( | ||
1192 | "RegionUUID" uuid NULL, | ||
1193 | "Revision" int NULL, | ||
1194 | "Heightfield" bytea NULL | ||
1195 | ); | ||
1196 | |||
1197 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index 25f3ad9..64624db 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations | |||
@@ -352,3 +352,14 @@ BEGIN; | |||
352 | ALTER TABLE prims ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default '0'; | 352 | ALTER TABLE prims ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default '0'; |
353 | 353 | ||
354 | COMMIT; | 354 | COMMIT; |
355 | |||
356 | :VERSION 34 #---- add baked terrain store | ||
357 | |||
358 | BEGIN; | ||
359 | |||
360 | CREATE TABLE IF NOT EXISTS bakedterrain( | ||
361 | RegionUUID varchar(255), | ||
362 | Revision integer, | ||
363 | Heightfield blob); | ||
364 | |||
365 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index cd20c4e..76b367a 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs | |||
@@ -827,7 +827,7 @@ namespace OpenSim.Data.SQLite | |||
827 | } | 827 | } |
828 | 828 | ||
829 | /// <summary> | 829 | /// <summary> |
830 | /// Store a terrain revision in region storage | 830 | /// Store a terrain in region storage |
831 | /// </summary> | 831 | /// </summary> |
832 | /// <param name="ter">terrain heightfield</param> | 832 | /// <param name="ter">terrain heightfield</param> |
833 | /// <param name="regionID">region UUID</param> | 833 | /// <param name="regionID">region UUID</param> |
@@ -851,7 +851,44 @@ namespace OpenSim.Data.SQLite | |||
851 | Array terrainDBblob; | 851 | Array terrainDBblob; |
852 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | 852 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); |
853 | 853 | ||
854 | m_log.DebugFormat("{0} Storing terrain revision r {1}", LogHeader, terrainDBRevision); | 854 | m_log.DebugFormat("{0} Storing terrain format {1}", LogHeader, terrainDBRevision); |
855 | |||
856 | using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) | ||
857 | { | ||
858 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); | ||
859 | cmd.Parameters.Add(new SqliteParameter(":Revision", terrainDBRevision)); | ||
860 | cmd.Parameters.Add(new SqliteParameter(":Heightfield", terrainDBblob)); | ||
861 | cmd.ExecuteNonQuery(); | ||
862 | } | ||
863 | } | ||
864 | } | ||
865 | |||
866 | /// <summary> | ||
867 | /// Store baked terrain in region storage | ||
868 | /// </summary> | ||
869 | /// <param name="ter">terrain heightfield</param> | ||
870 | /// <param name="regionID">region UUID</param> | ||
871 | public void StoreBakedTerrain(TerrainData terrData, UUID regionID) | ||
872 | { | ||
873 | lock (ds) | ||
874 | { | ||
875 | using ( | ||
876 | SqliteCommand cmd = new SqliteCommand("delete from bakedterrain where RegionUUID=:RegionUUID", m_conn)) | ||
877 | { | ||
878 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); | ||
879 | cmd.ExecuteNonQuery(); | ||
880 | } | ||
881 | |||
882 | // the following is an work around for .NET. The perf | ||
883 | // issues associated with it aren't as bad as you think. | ||
884 | String sql = "insert into bakedterrain(RegionUUID, Revision, Heightfield)" + | ||
885 | " values(:RegionUUID, :Revision, :Heightfield)"; | ||
886 | |||
887 | int terrainDBRevision; | ||
888 | Array terrainDBblob; | ||
889 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | ||
890 | |||
891 | m_log.DebugFormat("{0} Storing bakedterrain format {1}", LogHeader, terrainDBRevision); | ||
855 | 892 | ||
856 | using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) | 893 | using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) |
857 | { | 894 | { |
@@ -1354,7 +1391,7 @@ namespace OpenSim.Data.SQLite | |||
1354 | createCol(land, "Name", typeof(String)); | 1391 | createCol(land, "Name", typeof(String)); |
1355 | createCol(land, "Desc", typeof(String)); | 1392 | createCol(land, "Desc", typeof(String)); |
1356 | createCol(land, "OwnerUUID", typeof(String)); | 1393 | createCol(land, "OwnerUUID", typeof(String)); |
1357 | createCol(land, "IsGroupOwned", typeof(String)); | 1394 | createCol(land, "IsGroupOwned", typeof(Boolean)); |
1358 | createCol(land, "Area", typeof(Int32)); | 1395 | createCol(land, "Area", typeof(Int32)); |
1359 | createCol(land, "AuctionID", typeof(Int32)); //Unemplemented | 1396 | createCol(land, "AuctionID", typeof(Int32)); //Unemplemented |
1360 | createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory | 1397 | createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory |
@@ -1387,9 +1424,6 @@ namespace OpenSim.Data.SQLite | |||
1387 | createCol(land, "MediaLoop", typeof(Boolean)); | 1424 | createCol(land, "MediaLoop", typeof(Boolean)); |
1388 | createCol(land, "ObscureMedia", typeof(Boolean)); | 1425 | createCol(land, "ObscureMedia", typeof(Boolean)); |
1389 | createCol(land, "ObscureMusic", typeof(Boolean)); | 1426 | createCol(land, "ObscureMusic", typeof(Boolean)); |
1390 | createCol(land, "SeeAVs", typeof(Boolean)); | ||
1391 | createCol(land, "AnyAVSounds", typeof(Boolean)); | ||
1392 | createCol(land, "GroupAVSounds", typeof(Boolean)); | ||
1393 | 1427 | ||
1394 | land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; | 1428 | land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; |
1395 | 1429 | ||
@@ -1832,7 +1866,7 @@ namespace OpenSim.Data.SQLite | |||
1832 | newData.Name = (String)row["Name"]; | 1866 | newData.Name = (String)row["Name"]; |
1833 | newData.Description = (String)row["Desc"]; | 1867 | newData.Description = (String)row["Desc"]; |
1834 | newData.OwnerID = (UUID)(String)row["OwnerUUID"]; | 1868 | newData.OwnerID = (UUID)(String)row["OwnerUUID"]; |
1835 | newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); | 1869 | newData.IsGroupOwned = (Boolean)row["IsGroupOwned"]; |
1836 | newData.Area = Convert.ToInt32(row["Area"]); | 1870 | newData.Area = Convert.ToInt32(row["Area"]); |
1837 | newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented | 1871 | newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented |
1838 | newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]); | 1872 | newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]); |
@@ -2248,7 +2282,7 @@ namespace OpenSim.Data.SQLite | |||
2248 | row["Name"] = land.Name; | 2282 | row["Name"] = land.Name; |
2249 | row["Desc"] = land.Description; | 2283 | row["Desc"] = land.Description; |
2250 | row["OwnerUUID"] = land.OwnerID.ToString(); | 2284 | row["OwnerUUID"] = land.OwnerID.ToString(); |
2251 | row["IsGroupOwned"] = land.IsGroupOwned.ToString(); | 2285 | row["IsGroupOwned"] = land.IsGroupOwned; |
2252 | row["Area"] = land.Area; | 2286 | row["Area"] = land.Area; |
2253 | row["AuctionID"] = land.AuctionID; //Unemplemented | 2287 | row["AuctionID"] = land.AuctionID; //Unemplemented |
2254 | row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory | 2288 | row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory |
@@ -2942,9 +2976,6 @@ namespace OpenSim.Data.SQLite | |||
2942 | { | 2976 | { |
2943 | return DbType.Binary; | 2977 | return DbType.Binary; |
2944 | } | 2978 | } |
2945 | else if (type == typeof(Boolean)) { | ||
2946 | return DbType.Boolean; | ||
2947 | } | ||
2948 | else | 2979 | else |
2949 | { | 2980 | { |
2950 | return DbType.String; | 2981 | return DbType.String; |