diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 47 |
1 files changed, 47 insertions, 0 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 | { |