* Fixed MonoSQLite Update Table routine
* Charles, this will fix the red issue. * Same situation, the first run updates the tables (and gives you a ton of red errors), the second run and everything works as expected.afrisby
parent
997a2907e2
commit
d82ed9a8c5
|
@ -702,12 +702,12 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
{
|
||||
prim.SetSitTargetLL(new LLVector3(
|
||||
Convert.ToSingle(row["SitTargetOffsetX"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetX"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetY"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
|
||||
Convert.ToSingle(row["SitTargetOrientW"]),
|
||||
Convert.ToSingle(row["SitTargetOrientX"]),
|
||||
Convert.ToSingle(row["SitTargetOrientY"]),
|
||||
Convert.ToSingle(row["SitTargetOrientX"])));
|
||||
Convert.ToSingle(row["SitTargetOrientZ"]),
|
||||
Convert.ToSingle(row["SitTargetOrientW"])));
|
||||
}
|
||||
catch (System.InvalidCastException)
|
||||
{
|
||||
|
@ -828,17 +828,30 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
row["RotationZ"] = prim.RotationOffset.Z;
|
||||
row["RotationW"] = prim.RotationOffset.W;
|
||||
|
||||
// Sit target
|
||||
LLVector3 sitTargetPos = prim.GetSitTargetPositionLL();
|
||||
row["SitTargetOffsetX"] = sitTargetPos.X;
|
||||
row["SitTargetOffsetY"] = sitTargetPos.Y;
|
||||
row["SitTargetOffsetZ"] = sitTargetPos.Z;
|
||||
try
|
||||
{
|
||||
// Sit target
|
||||
LLVector3 sitTargetPos = prim.GetSitTargetPositionLL();
|
||||
row["SitTargetOffsetX"] = sitTargetPos.X;
|
||||
row["SitTargetOffsetY"] = sitTargetPos.Y;
|
||||
row["SitTargetOffsetZ"] = sitTargetPos.Z;
|
||||
|
||||
LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL();
|
||||
row["SitTargetOrientW"] = sitTargetOrient.W;
|
||||
row["SitTargetOrientX"] = sitTargetOrient.X;
|
||||
row["SitTargetOrientY"] = sitTargetOrient.Y;
|
||||
row["SitTargetOrientZ"] = sitTargetOrient.Z;
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException)
|
||||
{
|
||||
// Database table was created before we got here and needs to be created! :P
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL();
|
||||
row["SitTargetOrientW"] = sitTargetOrient.W;
|
||||
row["SitTargetOrientX"] = sitTargetOrient.X;
|
||||
row["SitTargetOrientY"] = sitTargetOrient.Y;
|
||||
row["SitTargetOrientZ"] = sitTargetOrient.Z;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -804,13 +804,13 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public LLQuaternion GetSitTargetOrientationLL()
|
||||
{
|
||||
return new LLQuaternion(m_sitTargetOrientation.w, m_sitTargetOrientation.x, m_sitTargetOrientation.y, m_sitTargetOrientation.z);
|
||||
return new LLQuaternion( m_sitTargetOrientation.x, m_sitTargetOrientation.y, m_sitTargetOrientation.z,m_sitTargetOrientation.w);
|
||||
}
|
||||
|
||||
// Utility function so the databases don't have to reference axiom.math
|
||||
public void SetSitTargetLL(LLVector3 offset, LLQuaternion orientation)
|
||||
{
|
||||
if (!(offset.X == 0 && offset.Y == 0 && offset.Z == 0 && (orientation.W == 0 || orientation.W == 1) && orientation.X == 0 && orientation.Y == 0 && (orientation.Z == 0 || orientation.Z == 0)))
|
||||
if (!(offset.X == 0 && offset.Y == 0 && offset.Z == 0 && (orientation.W == 0 || orientation.W == 1) && orientation.X == 0 && orientation.Y == 0 && orientation.Z == 0))
|
||||
{
|
||||
m_sitTargetPosition = new Vector3(offset.X, offset.Y, offset.Z);
|
||||
m_sitTargetOrientation = new Quaternion(orientation.W, orientation.X, orientation.Y, orientation.Z);
|
||||
|
|
|
@ -522,12 +522,12 @@ namespace OpenSim.DataStore.MSSQL
|
|||
{
|
||||
prim.SetSitTargetLL(new LLVector3(
|
||||
Convert.ToSingle(row["SitTargetOffsetX"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetX"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetY"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
|
||||
Convert.ToSingle(row["SitTargetOrientW"]),
|
||||
Convert.ToSingle(row["SitTargetOrientX"]),
|
||||
Convert.ToSingle(row["SitTargetOrientY"]),
|
||||
Convert.ToSingle(row["SitTargetOrientX"])));
|
||||
Convert.ToSingle(row["SitTargetOrientZ"]),
|
||||
Convert.ToSingle(row["SitTargetOrientW"])));
|
||||
}
|
||||
catch (System.InvalidCastException)
|
||||
{
|
||||
|
|
|
@ -783,20 +783,34 @@ namespace OpenSim.DataStore.MonoSqlite
|
|||
{
|
||||
prim.SetSitTargetLL(new LLVector3(
|
||||
Convert.ToSingle(row["SitTargetOffsetX"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetX"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetY"]),
|
||||
Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
|
||||
Convert.ToSingle(row["SitTargetOrientW"]),
|
||||
Convert.ToSingle(row["SitTargetOrientX"]),
|
||||
Convert.ToSingle(row["SitTargetOrientY"]),
|
||||
Convert.ToSingle(row["SitTargetOrientX"])));
|
||||
Convert.ToSingle(row["SitTargetOrientZ"]),
|
||||
Convert.ToSingle(row["SitTargetOrientW"])));
|
||||
}
|
||||
catch (System.InvalidCastException)
|
||||
{
|
||||
// Database table was created before we got here and now has null values :P
|
||||
using (SqliteCommand cmd = new SqliteCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_conn))
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
m_conn.Open();
|
||||
SqliteCommand cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetX float NOT NULL default 0;", m_conn);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetY float NOT NULL default 0;", m_conn);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetZ float NOT NULL default 0;", m_conn);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientW float NOT NULL default 0;", m_conn);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientX float NOT NULL default 0;", m_conn);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientY float NOT NULL default 0;", m_conn);
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientZ float NOT NULL default 0;", m_conn);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return prim;
|
||||
|
|
Loading…
Reference in New Issue