diff options
author | Sean Dague | 2008-09-16 19:51:14 +0000 |
---|---|---|
committer | Sean Dague | 2008-09-16 19:51:14 +0000 |
commit | ad379ed136c936f924ecec3e784438ed7248fd84 (patch) | |
tree | 519dd0755d3baca7d04449f5faae5ee9da7b6a7a /OpenSim/Data/SQLite/SQLiteRegionData.cs | |
parent | we can use equals on strings because they are comparible, and (diff) | |
download | opensim-SC_OLD-ad379ed136c936f924ecec3e784438ed7248fd84.zip opensim-SC_OLD-ad379ed136c936f924ecec3e784438ed7248fd84.tar.gz opensim-SC_OLD-ad379ed136c936f924ecec3e784438ed7248fd84.tar.bz2 opensim-SC_OLD-ad379ed136c936f924ecec3e784438ed7248fd84.tar.xz |
Added some terrain tests, and found a fun race condition in the sqlite
terrain driver in the process, which is now fixed. yay for unit tests!
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteRegionData.cs')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 41d108e..fef5e3b 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -470,20 +470,6 @@ namespace OpenSim.Data.SQLite | |||
470 | { | 470 | { |
471 | int revision = Util.UnixTimeSinceEpoch(); | 471 | int revision = Util.UnixTimeSinceEpoch(); |
472 | 472 | ||
473 | // the following is an work around for .NET. The perf | ||
474 | // issues associated with it aren't as bad as you think. | ||
475 | m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); | ||
476 | String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + | ||
477 | " values(:RegionUUID, :Revision, :Heightfield)"; | ||
478 | |||
479 | using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) | ||
480 | { | ||
481 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); | ||
482 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); | ||
483 | cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter))); | ||
484 | cmd.ExecuteNonQuery(); | ||
485 | } | ||
486 | |||
487 | // This is added to get rid of the infinitely growing | 473 | // This is added to get rid of the infinitely growing |
488 | // terrain databases which negatively impact on SQLite | 474 | // terrain databases which negatively impact on SQLite |
489 | // over time. Before reenabling this feature there | 475 | // over time. Before reenabling this feature there |
@@ -493,13 +479,27 @@ namespace OpenSim.Data.SQLite | |||
493 | 479 | ||
494 | using ( | 480 | using ( |
495 | SqliteCommand cmd = | 481 | SqliteCommand cmd = |
496 | new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision < :Revision", | 482 | new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision", |
497 | m_conn)) | 483 | m_conn)) |
498 | { | 484 | { |
499 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); | 485 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); |
500 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); | 486 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); |
501 | cmd.ExecuteNonQuery(); | 487 | cmd.ExecuteNonQuery(); |
502 | } | 488 | } |
489 | |||
490 | // the following is an work around for .NET. The perf | ||
491 | // issues associated with it aren't as bad as you think. | ||
492 | m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); | ||
493 | String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + | ||
494 | " values(:RegionUUID, :Revision, :Heightfield)"; | ||
495 | |||
496 | using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) | ||
497 | { | ||
498 | cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); | ||
499 | cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); | ||
500 | cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter))); | ||
501 | cmd.ExecuteNonQuery(); | ||
502 | } | ||
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||