aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
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 }