aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-27 05:37:48 +0000
committerTeravus Ovares2007-12-27 05:37:48 +0000
commitcbf5ff4a9371c067dbe36ef28487c8784b9229d2 (patch)
treea5b16f0cd840374dc475153d77671f1d20f06ac7 /OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite
parent* Added osRegionRestart(float secs) to LSL Commands (diff)
downloadopensim-SC_OLD-cbf5ff4a9371c067dbe36ef28487c8784b9229d2.zip
opensim-SC_OLD-cbf5ff4a9371c067dbe36ef28487c8784b9229d2.tar.gz
opensim-SC_OLD-cbf5ff4a9371c067dbe36ef28487c8784b9229d2.tar.bz2
opensim-SC_OLD-cbf5ff4a9371c067dbe36ef28487c8784b9229d2.tar.xz
* Added Sit Target persistence over sim restarts for mySQL and MonoSQLite.
* SAVE YOUR PRIM DATA, THIS MAKES CHANGES TO YOUR PRIMS TABLE * The first time you run OpenSim after updating past this revision, you'll see a lot of Errors. Be calm, shutdown the simulator, and start it again and your prims table will be updated. * MSSQL added the fields to the Initial CreateTable section, however, you'll need to add the fields to your prims table if you want it to persist.
Diffstat (limited to 'OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite')
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs48
1 files changed, 48 insertions, 0 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index 6750e4d..5bf4551 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -56,6 +56,8 @@ namespace OpenSim.DataStore.MonoSqlite
56 private SqliteDataAdapter landDa; 56 private SqliteDataAdapter landDa;
57 private SqliteDataAdapter landAccessListDa; 57 private SqliteDataAdapter landAccessListDa;
58 58
59 private SqliteConnection m_conn;
60
59 private String m_connectionString; 61 private String m_connectionString;
60 62
61 private bool persistPrimInventories; 63 private bool persistPrimInventories;
@@ -77,6 +79,9 @@ namespace OpenSim.DataStore.MonoSqlite
77 MainLog.Instance.Verbose("DATASTORE", "Sqlite - connecting: " + connectionString); 79 MainLog.Instance.Verbose("DATASTORE", "Sqlite - connecting: " + connectionString);
78 SqliteConnection conn = new SqliteConnection(m_connectionString); 80 SqliteConnection conn = new SqliteConnection(m_connectionString);
79 81
82 // Arg! Hate databases..
83 m_conn = conn;
84
80 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); 85 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn);
81 primDa = new SqliteDataAdapter(primSelectCmd); 86 primDa = new SqliteDataAdapter(primSelectCmd);
82 // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); 87 // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
@@ -564,6 +569,16 @@ namespace OpenSim.DataStore.MonoSqlite
564 createCol(prims, "RotationZ", typeof (Double)); 569 createCol(prims, "RotationZ", typeof (Double));
565 createCol(prims, "RotationW", typeof (Double)); 570 createCol(prims, "RotationW", typeof (Double));
566 571
572 // sit target
573 createCol(prims, "SitTargetOffsetX", typeof(Double));
574 createCol(prims, "SitTargetOffsetY", typeof(Double));
575 createCol(prims, "SitTargetOffsetZ", typeof(Double));
576
577 createCol(prims, "SitTargetOrientW", typeof(Double));
578 createCol(prims, "SitTargetOrientX", typeof(Double));
579 createCol(prims, "SitTargetOrientY", typeof(Double));
580 createCol(prims, "SitTargetOrientZ", typeof(Double));
581
567 // Add in contraints 582 // Add in contraints
568 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; 583 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
569 584
@@ -764,6 +779,26 @@ namespace OpenSim.DataStore.MonoSqlite
764 Convert.ToSingle(row["RotationW"]) 779 Convert.ToSingle(row["RotationW"])
765 ); 780 );
766 781
782 try
783 {
784 prim.SetSitTargetLL(new LLVector3(
785 Convert.ToSingle(row["SitTargetOffsetX"]),
786 Convert.ToSingle(row["SitTargetOffsetX"]),
787 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
788 Convert.ToSingle(row["SitTargetOrientW"]),
789 Convert.ToSingle(row["SitTargetOrientX"]),
790 Convert.ToSingle(row["SitTargetOrientY"]),
791 Convert.ToSingle(row["SitTargetOrientX"])));
792 }
793 catch (System.InvalidCastException)
794 {
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))
797 {
798 cmd.ExecuteNonQuery();
799 }
800 }
801
767 return prim; 802 return prim;
768 } 803 }
769 804
@@ -889,6 +924,18 @@ namespace OpenSim.DataStore.MonoSqlite
889 row["RotationY"] = prim.RotationOffset.Y; 924 row["RotationY"] = prim.RotationOffset.Y;
890 row["RotationZ"] = prim.RotationOffset.Z; 925 row["RotationZ"] = prim.RotationOffset.Z;
891 row["RotationW"] = prim.RotationOffset.W; 926 row["RotationW"] = prim.RotationOffset.W;
927
928 // Sit target
929 LLVector3 sitTargetPos = prim.GetSitTargetPositionLL();
930 row["SitTargetOffsetX"] = sitTargetPos.X;
931 row["SitTargetOffsetY"] = sitTargetPos.Y;
932 row["SitTargetOffsetZ"] = sitTargetPos.Z;
933
934 LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL();
935 row["SitTargetOrientW"] = sitTargetOrient.W;
936 row["SitTargetOrientX"] = sitTargetOrient.X;
937 row["SitTargetOrientY"] = sitTargetOrient.Y;
938 row["SitTargetOrientZ"] = sitTargetOrient.Z;
892 } 939 }
893 940
894 private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) 941 private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
@@ -1331,6 +1378,7 @@ namespace OpenSim.DataStore.MonoSqlite
1331 DataSet tmpDS = new DataSet(); 1378 DataSet tmpDS = new DataSet();
1332 try 1379 try
1333 { 1380 {
1381
1334 pDa.Fill(tmpDS, "prims"); 1382 pDa.Fill(tmpDS, "prims");
1335 sDa.Fill(tmpDS, "primshapes"); 1383 sDa.Fill(tmpDS, "primshapes");
1336 1384