aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLSimulationData.cs
diff options
context:
space:
mode:
authorMelanie2011-12-05 15:46:57 +0100
committerMelanie2011-12-05 15:46:57 +0100
commitb7c9eb4bf78b831c920f6a6f1aed4df903b9e4f4 (patch)
treef27d1d80f3d85f90c9ccc0db8487ff56a9809756 /OpenSim/Data/MySQL/MySQLSimulationData.cs
parentFix setting seated avatar position and make llSameGroup work as in SL. (diff)
downloadopensim-SC-b7c9eb4bf78b831c920f6a6f1aed4df903b9e4f4.zip
opensim-SC-b7c9eb4bf78b831c920f6a6f1aed4df903b9e4f4.tar.gz
opensim-SC-b7c9eb4bf78b831c920f6a6f1aed4df903b9e4f4.tar.bz2
opensim-SC-b7c9eb4bf78b831c920f6a6f1aed4df903b9e4f4.tar.xz
Don't allow deletion of a terrain from the database unless we have one to replace it with
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs28
1 files changed, 21 insertions, 7 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 3437250..b201c51 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -574,15 +574,29 @@ namespace OpenSim.Data.MySQL
574 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; 574 cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID";
575 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); 575 cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
576 576
577 ExecuteNonQuery(cmd); 577 using (MySqlCommand cmd2 = dbcon.CreateCommand())
578 578 {
579 cmd.CommandText = "insert into terrain (RegionUUID, " + 579 try
580 "Revision, Heightfield) values (?RegionUUID, " + 580 {
581 "1, ?Heightfield)"; 581 cmd2.CommandText = "insert into terrain (RegionUUID, " +
582 "Revision, Heightfield) values (?RegionUUID, " +
583 "1, ?Heightfield)";
582 584
583 cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); 585 cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString());
586 cmd2.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter));
584 587
585 ExecuteNonQuery(cmd); 588 ExecuteNonQuery(cmd);
589 ExecuteNonQuery(cmd2);
590 }
591 catch
592 {
593 // If we get here there is a NaN in the terrain
594 // and the terrain can't be saved. A crash here
595 // is much better than losing all the work
596 m_log.ErrorFormat("[DATA]: Unable to save terrain. Stopping simulator to prevent data loss");
597 Environment.Exit(1);
598 }
599 }
586 } 600 }
587 } 601 }
588 } 602 }