* Applying Mantis Patch #518.2 - State not persisted in MySQL DataStore

0.6.0-stable
Adam Frisby 2008-03-18 14:54:44 +00:00
parent bf8b5844f2
commit aad69b9018
1 changed files with 35 additions and 0 deletions

View File

@ -718,6 +718,7 @@ namespace OpenSim.Framework.Data.MySQL
createCol(shapes, "ProfileEnd", typeof (Int32)); createCol(shapes, "ProfileEnd", typeof (Int32));
createCol(shapes, "ProfileCurve", typeof (Int32)); createCol(shapes, "ProfileCurve", typeof (Int32));
createCol(shapes, "ProfileHollow", typeof (Int32)); createCol(shapes, "ProfileHollow", typeof (Int32));
createCol(shapes, "State", typeof(Int32));
createCol(shapes, "Texture", typeof (Byte[])); createCol(shapes, "Texture", typeof (Byte[]));
createCol(shapes, "ExtraParams", typeof (Byte[])); createCol(shapes, "ExtraParams", typeof (Byte[]));
@ -1137,6 +1138,24 @@ namespace OpenSim.Framework.Data.MySQL
s.ExtraParams = (byte[]) row["ExtraParams"]; 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; return s;
} }
@ -1173,6 +1192,22 @@ namespace OpenSim.Framework.Data.MySQL
row["ProfileHollow"] = s.ProfileHollow; row["ProfileHollow"] = s.ProfileHollow;
row["Texture"] = s.TextureEntry; row["Texture"] = s.TextureEntry;
row["ExtraParams"] = s.ExtraParams; 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) private void addPrim(SceneObjectPart prim, LLUUID sceneGroupID, LLUUID regionUUID)