aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-27 18:49:16 +0000
committerTeravus Ovares2007-12-27 18:49:16 +0000
commitd82ed9a8c5aff8c95ce1c9aa092d68a4f649fa07 (patch)
tree3f9893938093c9c45ed8929890e42fb9f2cb3e35
parentMove hardcoded texture library inventory items out into OpenSimLibrary/xml. ... (diff)
downloadopensim-SC_OLD-d82ed9a8c5aff8c95ce1c9aa092d68a4f649fa07.zip
opensim-SC_OLD-d82ed9a8c5aff8c95ce1c9aa092d68a4f649fa07.tar.gz
opensim-SC_OLD-d82ed9a8c5aff8c95ce1c9aa092d68a4f649fa07.tar.bz2
opensim-SC_OLD-d82ed9a8c5aff8c95ce1c9aa092d68a4f649fa07.tar.xz
* 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.
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLDataStore.cs41
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs4
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs6
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs28
4 files changed, 53 insertions, 26 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
index 06a5814..c48c88f 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
@@ -702,12 +702,12 @@ namespace OpenSim.Framework.Data.MySQL
702 { 702 {
703 prim.SetSitTargetLL(new LLVector3( 703 prim.SetSitTargetLL(new LLVector3(
704 Convert.ToSingle(row["SitTargetOffsetX"]), 704 Convert.ToSingle(row["SitTargetOffsetX"]),
705 Convert.ToSingle(row["SitTargetOffsetX"]), 705 Convert.ToSingle(row["SitTargetOffsetY"]),
706 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( 706 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
707 Convert.ToSingle(row["SitTargetOrientW"]),
708 Convert.ToSingle(row["SitTargetOrientX"]), 707 Convert.ToSingle(row["SitTargetOrientX"]),
709 Convert.ToSingle(row["SitTargetOrientY"]), 708 Convert.ToSingle(row["SitTargetOrientY"]),
710 Convert.ToSingle(row["SitTargetOrientX"]))); 709 Convert.ToSingle(row["SitTargetOrientZ"]),
710 Convert.ToSingle(row["SitTargetOrientW"])));
711 } 711 }
712 catch (System.InvalidCastException) 712 catch (System.InvalidCastException)
713 { 713 {
@@ -828,17 +828,30 @@ namespace OpenSim.Framework.Data.MySQL
828 row["RotationZ"] = prim.RotationOffset.Z; 828 row["RotationZ"] = prim.RotationOffset.Z;
829 row["RotationW"] = prim.RotationOffset.W; 829 row["RotationW"] = prim.RotationOffset.W;
830 830
831 // Sit target 831 try
832 LLVector3 sitTargetPos = prim.GetSitTargetPositionLL(); 832 {
833 row["SitTargetOffsetX"] = sitTargetPos.X; 833 // Sit target
834 row["SitTargetOffsetY"] = sitTargetPos.Y; 834 LLVector3 sitTargetPos = prim.GetSitTargetPositionLL();
835 row["SitTargetOffsetZ"] = sitTargetPos.Z; 835 row["SitTargetOffsetX"] = sitTargetPos.X;
836 836 row["SitTargetOffsetY"] = sitTargetPos.Y;
837 LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL(); 837 row["SitTargetOffsetZ"] = sitTargetPos.Z;
838 row["SitTargetOrientW"] = sitTargetOrient.W; 838
839 row["SitTargetOrientX"] = sitTargetOrient.X; 839 LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL();
840 row["SitTargetOrientY"] = sitTargetOrient.Y; 840 row["SitTargetOrientW"] = sitTargetOrient.W;
841 row["SitTargetOrientZ"] = sitTargetOrient.Z; 841 row["SitTargetOrientX"] = sitTargetOrient.X;
842 row["SitTargetOrientY"] = sitTargetOrient.Y;
843 row["SitTargetOrientZ"] = sitTargetOrient.Z;
844 }
845 catch (MySql.Data.MySqlClient.MySqlException)
846 {
847 // Database table was created before we got here and needs to be created! :P
848
849 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))
850 {
851 cmd.ExecuteNonQuery();
852 }
853 }
854
842 855
843 } 856 }
844 857
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 29a163b..f226150 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -804,13 +804,13 @@ namespace OpenSim.Region.Environment.Scenes
804 804
805 public LLQuaternion GetSitTargetOrientationLL() 805 public LLQuaternion GetSitTargetOrientationLL()
806 { 806 {
807 return new LLQuaternion(m_sitTargetOrientation.w, m_sitTargetOrientation.x, m_sitTargetOrientation.y, m_sitTargetOrientation.z); 807 return new LLQuaternion( m_sitTargetOrientation.x, m_sitTargetOrientation.y, m_sitTargetOrientation.z,m_sitTargetOrientation.w);
808 } 808 }
809 809
810 // Utility function so the databases don't have to reference axiom.math 810 // Utility function so the databases don't have to reference axiom.math
811 public void SetSitTargetLL(LLVector3 offset, LLQuaternion orientation) 811 public void SetSitTargetLL(LLVector3 offset, LLQuaternion orientation)
812 { 812 {
813 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))) 813 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))
814 { 814 {
815 m_sitTargetPosition = new Vector3(offset.X, offset.Y, offset.Z); 815 m_sitTargetPosition = new Vector3(offset.X, offset.Y, offset.Z);
816 m_sitTargetOrientation = new Quaternion(orientation.W, orientation.X, orientation.Y, orientation.Z); 816 m_sitTargetOrientation = new Quaternion(orientation.W, orientation.X, orientation.Y, orientation.Z);
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
index 0a48126..60aeb83 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
@@ -522,12 +522,12 @@ namespace OpenSim.DataStore.MSSQL
522 { 522 {
523 prim.SetSitTargetLL(new LLVector3( 523 prim.SetSitTargetLL(new LLVector3(
524 Convert.ToSingle(row["SitTargetOffsetX"]), 524 Convert.ToSingle(row["SitTargetOffsetX"]),
525 Convert.ToSingle(row["SitTargetOffsetX"]), 525 Convert.ToSingle(row["SitTargetOffsetY"]),
526 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( 526 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
527 Convert.ToSingle(row["SitTargetOrientW"]),
528 Convert.ToSingle(row["SitTargetOrientX"]), 527 Convert.ToSingle(row["SitTargetOrientX"]),
529 Convert.ToSingle(row["SitTargetOrientY"]), 528 Convert.ToSingle(row["SitTargetOrientY"]),
530 Convert.ToSingle(row["SitTargetOrientX"]))); 529 Convert.ToSingle(row["SitTargetOrientZ"]),
530 Convert.ToSingle(row["SitTargetOrientW"])));
531 } 531 }
532 catch (System.InvalidCastException) 532 catch (System.InvalidCastException)
533 { 533 {
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index 9118082..c885310 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -783,20 +783,34 @@ namespace OpenSim.DataStore.MonoSqlite
783 { 783 {
784 prim.SetSitTargetLL(new LLVector3( 784 prim.SetSitTargetLL(new LLVector3(
785 Convert.ToSingle(row["SitTargetOffsetX"]), 785 Convert.ToSingle(row["SitTargetOffsetX"]),
786 Convert.ToSingle(row["SitTargetOffsetX"]), 786 Convert.ToSingle(row["SitTargetOffsetY"]),
787 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( 787 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
788 Convert.ToSingle(row["SitTargetOrientW"]),
789 Convert.ToSingle(row["SitTargetOrientX"]), 788 Convert.ToSingle(row["SitTargetOrientX"]),
790 Convert.ToSingle(row["SitTargetOrientY"]), 789 Convert.ToSingle(row["SitTargetOrientY"]),
791 Convert.ToSingle(row["SitTargetOrientX"]))); 790 Convert.ToSingle(row["SitTargetOrientZ"]),
791 Convert.ToSingle(row["SitTargetOrientW"])));
792 } 792 }
793 catch (System.InvalidCastException) 793 catch (System.InvalidCastException)
794 { 794 {
795 // Database table was created before we got here and now has null values :P 795 // Database table was created before we got here and now has null values :P
796 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)) 796 m_conn.Open();
797 { 797 SqliteCommand cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetX float NOT NULL default 0;", m_conn);
798 cmd.ExecuteNonQuery(); 798 cmd.ExecuteNonQuery();
799 } 799 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetY float NOT NULL default 0;", m_conn);
800 cmd.ExecuteNonQuery();
801 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetZ float NOT NULL default 0;", m_conn);
802 cmd.ExecuteNonQuery();
803 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientW float NOT NULL default 0;", m_conn);
804 cmd.ExecuteNonQuery();
805 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientX float NOT NULL default 0;", m_conn);
806 cmd.ExecuteNonQuery();
807 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientY float NOT NULL default 0;", m_conn);
808 cmd.ExecuteNonQuery();
809 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientZ float NOT NULL default 0;", m_conn);
810 cmd.ExecuteNonQuery();
811
812
813
800 } 814 }
801 815
802 return prim; 816 return prim;