From 3dc2010da6412941bfbcdb29007b12a8f37b7bef Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 29 Jun 2009 15:05:12 +0000 Subject: From: Chris Yeoh Attached is a patch that changes the oar file saving of creation date/time to an integer instead of a string. I did this after justincc emailed me saying there is a problem with internationalisation doing it the old way and I said I'd fix it. Its been tested with MySQL and I've made the changes for MSSQL but that hasn't been well tested. --- OpenSim/Data/MSSQL/MSSQLRegionData.cs | 19 +++++-------------- OpenSim/Data/MSSQL/Resources/023_RegionStore.sql | 7 +++++++ OpenSim/Data/MySQL/MySQLRegionData.cs | 17 ++++------------- OpenSim/Data/MySQL/Resources/031_RegionStore.sql | 7 +++++++ 4 files changed, 23 insertions(+), 27 deletions(-) create mode 100644 OpenSim/Data/MSSQL/Resources/023_RegionStore.sql create mode 100644 OpenSim/Data/MySQL/Resources/031_RegionStore.sql (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs index 293282e..1aaf2a5 100644 --- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs @@ -723,7 +723,7 @@ VALUES ,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se ,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit ,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position -,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_date] = @loaded_creation_date, [loaded_creation_time] = @loaded_creation_time, [loaded_creation_id] = @loaded_creation_id +,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id WHERE [regionUUID] = @regionUUID"; using (AutoClosingSqlCommand cmd = _Database.Query(sql)) @@ -777,14 +777,14 @@ VALUES [block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics], [terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne], [elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit], - [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_date], [loaded_creation_time], [loaded_creation_id] + [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id] ) VALUES (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide, @block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics, @terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne, @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit, - @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_date, @loaded_creation_time, @loaded_creation_id)"; + @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)"; using (AutoClosingSqlCommand cmd = _Database.Query(sql)) { @@ -845,15 +845,7 @@ VALUES ); newSettings.Covenant = new UUID((Guid)row["covenant"]); - if (row["loaded_creation_date"] is DBNull) - newSettings.LoadedCreationDate = ""; - else - newSettings.LoadedCreationDate = (String)row["loaded_creation_date"]; - - if (row["loaded_creation_time"] is DBNull) - newSettings.LoadedCreationTime = ""; - else - newSettings.LoadedCreationTime = (String)row["loaded_creation_time"]; + newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); if (row["loaded_creation_id"] is DBNull) newSettings.LoadedCreationID = ""; @@ -1257,8 +1249,7 @@ VALUES parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y)); parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z)); parameters.Add(_Database.CreateParameter("covenant", settings.Covenant)); - parameters.Add(_Database.CreateParameter("LoadedCreationDate", settings.LoadedCreationDate)); - parameters.Add(_Database.CreateParameter("LoadedCreationTime", settings.LoadedCreationTime)); + parameters.Add(_Database.CreateParameter("LoadedCreationDateTime", settings.LoadedCreationDateTime)); parameters.Add(_Database.CreateParameter("LoadedCreationID", settings.LoadedCreationID)); return parameters.ToArray(); diff --git a/OpenSim/Data/MSSQL/Resources/023_RegionStore.sql b/OpenSim/Data/MSSQL/Resources/023_RegionStore.sql new file mode 100644 index 0000000..61b08f1 --- /dev/null +++ b/OpenSim/Data/MSSQL/Resources/023_RegionStore.sql @@ -0,0 +1,7 @@ +BEGIN TRANSACTION + +ALTER TABLE regionsettings DROP COLUMN loaded_creation_date; +ALTER TABLE regionsettings DROP COLUMN loaded_creation_time; +ALTER TABLE regionsettings ADD COLUMN loaded_creation_datetime int unsigned NOT NULL default 0; + +COMMIT diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 72c089e..a72ae45 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -741,7 +741,7 @@ namespace OpenSim.Data.MySQL "terrain_raise_limit, terrain_lower_limit, " + "use_estate_sun, fixed_sun, sun_position, " + "covenant, Sandbox, sunvectorx, sunvectory, " + - "sunvectorz, loaded_creation_date, loaded_creation_time, " + + "sunvectorz, loaded_creation_datetime, " + "loaded_creation_id) values ( ?RegionUUID, ?BlockTerraform, " + "?BlockFly, ?AllowDamage, ?RestrictPushing, " + "?AllowLandResell, ?AllowLandJoinDivide, " + @@ -756,7 +756,7 @@ namespace OpenSim.Data.MySQL "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + "?SunPosition, ?Covenant, ?Sandbox, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + - "?LoadedCreationDate, ?LoadedCreationTime, ?LoadedCreationID)"; + "?LoadedCreationDateTime, ?LoadedCreationID)"; FillRegionSettingsCommand(cmd, rs); @@ -1042,15 +1042,7 @@ namespace OpenSim.Data.MySQL newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); newSettings.Covenant = new UUID((String) row["covenant"]); - if (row["loaded_creation_date"] is DBNull) - newSettings.LoadedCreationDate = ""; - else - newSettings.LoadedCreationDate = (String) row["loaded_creation_date"]; - - if (row["loaded_creation_time"] is DBNull) - newSettings.LoadedCreationTime = ""; - else - newSettings.LoadedCreationTime = (String) row["loaded_creation_time"]; + newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); if (row["loaded_creation_id"] is DBNull) newSettings.LoadedCreationID = ""; @@ -1375,8 +1367,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun); cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition); cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString()); - cmd.Parameters.AddWithValue("LoadedCreationDate", settings.LoadedCreationDate); - cmd.Parameters.AddWithValue("LoadedCreationTime", settings.LoadedCreationTime); + cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDate); cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); } diff --git a/OpenSim/Data/MySQL/Resources/031_RegionStore.sql b/OpenSim/Data/MySQL/Resources/031_RegionStore.sql new file mode 100644 index 0000000..d069296 --- /dev/null +++ b/OpenSim/Data/MySQL/Resources/031_RegionStore.sql @@ -0,0 +1,7 @@ +BEGIN; + +ALTER TABLE regionsettings DROP COLUMN loaded_creation_date; +ALTER TABLE regionsettings DROP COLUMN loaded_creation_time; +ALTER TABLE regionsettings ADD COLUMN loaded_creation_datetime int unsigned NOT NULL default 0; + +COMMIT; -- cgit v1.1