diff options
Diffstat (limited to 'OpenSim/Data/PGSQL/PGSQLSimulationData.cs')
-rwxr-xr-x | OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 43 |
1 files changed, 43 insertions, 0 deletions
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> |