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 <yeohc@au1.ibm.com>

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/MySQL/MySQLRegionData.cs            | 17 ++++-------------
 OpenSim/Data/MySQL/Resources/031_RegionStore.sql |  7 +++++++
 2 files changed, 11 insertions(+), 13 deletions(-)
 create mode 100644 OpenSim/Data/MySQL/Resources/031_RegionStore.sql

(limited to 'OpenSim/Data/MySQL')

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