diff options
author | UbitUmarov | 2016-09-17 15:45:11 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-17 15:45:11 +0100 |
commit | 3f9f10529548599d1810ca8a630734586ed3fa9d (patch) | |
tree | c889183859774ec4eb1032af2502ecf294b505cd /OpenSim/Data/MySQL | |
parent | stop using legacy storeterrain in scene.cs (diff) | |
download | opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.zip opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.tar.gz opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.tar.bz2 opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.tar.xz |
add to databases a table to store baked terrain.
Diffstat (limited to 'OpenSim/Data/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 47 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Resources/RegionStore.migrations | 11 |
2 files changed, 58 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 | { |
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; | ||