From aad69b90186b1edd259479c776c1b19be78224fb Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 18 Mar 2008 14:54:44 +0000 Subject: * Applying Mantis Patch #518.2 - State not persisted in MySQL DataStore --- OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index 3a20b05..f4c839e 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs @@ -718,6 +718,7 @@ namespace OpenSim.Framework.Data.MySQL createCol(shapes, "ProfileEnd", typeof (Int32)); createCol(shapes, "ProfileCurve", typeof (Int32)); createCol(shapes, "ProfileHollow", typeof (Int32)); + createCol(shapes, "State", typeof(Int32)); createCol(shapes, "Texture", typeof (Byte[])); createCol(shapes, "ExtraParams", typeof (Byte[])); @@ -1137,6 +1138,24 @@ namespace OpenSim.Framework.Data.MySQL s.ExtraParams = (byte[]) row["ExtraParams"]; + try + { + s.State = Convert.ToByte(row["State"]); + } + catch (InvalidCastException) + { + // Database table was created before we got here and needs to be created! :P + + using ( + MySqlCommand cmd = + new MySqlCommand( + "ALTER TABLE `primshapes` ADD COLUMN `State` int NOT NULL default 0;", + m_connection)) + { + cmd.ExecuteNonQuery(); + } + } + return s; } @@ -1173,6 +1192,22 @@ namespace OpenSim.Framework.Data.MySQL row["ProfileHollow"] = s.ProfileHollow; row["Texture"] = s.TextureEntry; row["ExtraParams"] = s.ExtraParams; + try + { + row["State"] = s.State; + } + catch (MySqlException) + { + // Database table was created before we got here and needs to be created! :P + using ( + MySqlCommand cmd = + new MySqlCommand( + "ALTER TABLE `primshapes` ADD COLUMN `State` int NOT NULL default 0;", + m_connection)) + { + cmd.ExecuteNonQuery(); + } + } } private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID) -- cgit v1.1