From b233a4b2cab3a39f9edc17130cd7c2f2f807d6bb Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 9 May 2010 13:39:56 -0700 Subject: * Fixed spamming the assets table with map tiles. The tile image ID is now stored in regionsettings. Upon generation of a new tile image, the old one is deleted. Tested for SQLite and MySql standalone. * Fixed small bug with map search where the local sim regions weren't found. --- OpenSim/Data/MySQL/MySQLAssetData.cs | 5 +++-- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 6 +++++- OpenSim/Data/MySQL/Resources/033_RegionStore.sql | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 OpenSim/Data/MySQL/Resources/033_RegionStore.sql (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 35eed56..13f5fa2 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -111,7 +111,7 @@ namespace OpenSim.Data.MySQL dbcon.Open(); using (MySqlCommand cmd = new MySqlCommand( - "SELECT name, description, assetType, local, temporary, data FROM assets WHERE id=?id", + "SELECT name, description, assetType, local, temporary, asset_flags, data FROM assets WHERE id=?id", dbcon)) { cmd.Parameters.AddWithValue("?id", assetID.ToString()); @@ -133,6 +133,7 @@ namespace OpenSim.Data.MySQL asset.Local = false; asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); + asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); } } } @@ -345,7 +346,7 @@ namespace OpenSim.Data.MySQL using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) { dbcon.Open(); - MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id"); + MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon); cmd.Parameters.AddWithValue("?id", id); cmd.ExecuteNonQuery(); diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index a395ddc..8c83ef1 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -989,7 +989,8 @@ namespace OpenSim.Data.MySQL "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + "?SunPosition, ?Covenant, ?Sandbox, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + - "?LoadedCreationDateTime, ?LoadedCreationID)"; + "?LoadedCreationDateTime, ?LoadedCreationID)" + + "?map_tile_ID, ?TerrainImageID"; FillRegionSettingsCommand(cmd, rs); @@ -1276,6 +1277,8 @@ namespace OpenSim.Data.MySQL else newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; + newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); + return newSettings; } @@ -1596,6 +1599,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString()); cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); + cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); } diff --git a/OpenSim/Data/MySQL/Resources/033_RegionStore.sql b/OpenSim/Data/MySQL/Resources/033_RegionStore.sql new file mode 100644 index 0000000..2832b41 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/033_RegionStore.sql @@ -0,0 +1,3 @@ +BEGIN; +ALTER TABLE regionsettings ADD map_tile_ID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; +COMMIT; -- cgit v1.1 From 9cf6b81256b6c92cb5d5fb7a6db697f7784191e4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 9 May 2010 14:02:02 -0700 Subject: Yey for unit tests. The previous commit had a couple of bugs on SQL statements. Fixed here. --- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index 8c83ef1..d2892e9 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -989,8 +989,8 @@ namespace OpenSim.Data.MySQL "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + "?SunPosition, ?Covenant, ?Sandbox, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + - "?LoadedCreationDateTime, ?LoadedCreationID)" + - "?map_tile_ID, ?TerrainImageID"; + "?LoadedCreationDateTime, ?LoadedCreationID, " + + "?map_tile_ID)"; FillRegionSettingsCommand(cmd, rs); -- cgit v1.1 From 6f2f0fa0cad4c2668826f2684f5b8c2d9b30f243 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 9 May 2010 14:12:59 -0700 Subject: OK, this really fixes it, I promise. --- OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data/MySQL') diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs index d2892e9..07371e7 100644 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs @@ -975,7 +975,7 @@ namespace OpenSim.Data.MySQL "use_estate_sun, fixed_sun, sun_position, " + "covenant, Sandbox, sunvectorx, sunvectory, " + "sunvectorz, loaded_creation_datetime, " + - "loaded_creation_id) values (?RegionUUID, ?BlockTerraform, " + + "loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " + "?BlockFly, ?AllowDamage, ?RestrictPushing, " + "?AllowLandResell, ?AllowLandJoinDivide, " + "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + @@ -990,7 +990,7 @@ namespace OpenSim.Data.MySQL "?SunPosition, ?Covenant, ?Sandbox, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + "?LoadedCreationDateTime, ?LoadedCreationID, " + - "?map_tile_ID)"; + "?TerrainImageID)"; FillRegionSettingsCommand(cmd, rs); -- cgit v1.1