diff options
Diffstat (limited to 'OpenSim/Region/Storage')
-rw-r--r-- | OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs | 46 | ||||
-rw-r--r-- | OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | 48 |
2 files changed, 94 insertions, 0 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs index c6210f7..91edf5e 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs | |||
@@ -391,6 +391,16 @@ namespace OpenSim.DataStore.MSSQL | |||
391 | createCol(prims, "RotationZ", typeof(System.Double)); | 391 | createCol(prims, "RotationZ", typeof(System.Double)); |
392 | createCol(prims, "RotationW", typeof(System.Double)); | 392 | createCol(prims, "RotationW", typeof(System.Double)); |
393 | 393 | ||
394 | // sit target | ||
395 | createCol(prims, "SitTargetOffsetX", typeof(System.Double)); | ||
396 | createCol(prims, "SitTargetOffsetY", typeof(System.Double)); | ||
397 | createCol(prims, "SitTargetOffsetZ", typeof(System.Double)); | ||
398 | |||
399 | createCol(prims, "SitTargetOrientW", typeof(System.Double)); | ||
400 | createCol(prims, "SitTargetOrientX", typeof(System.Double)); | ||
401 | createCol(prims, "SitTargetOrientY", typeof(System.Double)); | ||
402 | createCol(prims, "SitTargetOrientZ", typeof(System.Double)); | ||
403 | |||
394 | // Add in contraints | 404 | // Add in contraints |
395 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; | 405 | prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; |
396 | 406 | ||
@@ -508,6 +518,22 @@ namespace OpenSim.DataStore.MSSQL | |||
508 | Convert.ToSingle(row["RotationW"]) | 518 | Convert.ToSingle(row["RotationW"]) |
509 | ); | 519 | ); |
510 | 520 | ||
521 | try | ||
522 | { | ||
523 | prim.SetSitTargetLL(new LLVector3( | ||
524 | Convert.ToSingle(row["SitTargetOffsetX"]), | ||
525 | Convert.ToSingle(row["SitTargetOffsetX"]), | ||
526 | Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( | ||
527 | Convert.ToSingle(row["SitTargetOrientW"]), | ||
528 | Convert.ToSingle(row["SitTargetOrientX"]), | ||
529 | Convert.ToSingle(row["SitTargetOrientY"]), | ||
530 | Convert.ToSingle(row["SitTargetOrientX"]))); | ||
531 | } | ||
532 | catch (System.InvalidCastException) | ||
533 | { | ||
534 | // Database table was created before we got here and now has null values :P | ||
535 | } | ||
536 | |||
511 | return prim; | 537 | return prim; |
512 | } | 538 | } |
513 | 539 | ||
@@ -557,6 +583,26 @@ namespace OpenSim.DataStore.MSSQL | |||
557 | row["RotationY"] = prim.RotationOffset.Y; | 583 | row["RotationY"] = prim.RotationOffset.Y; |
558 | row["RotationZ"] = prim.RotationOffset.Z; | 584 | row["RotationZ"] = prim.RotationOffset.Z; |
559 | row["RotationW"] = prim.RotationOffset.W; | 585 | row["RotationW"] = prim.RotationOffset.W; |
586 | |||
587 | try | ||
588 | { | ||
589 | // Sit target | ||
590 | LLVector3 sitTargetPos = prim.GetSitTargetPositionLL(); | ||
591 | row["SitTargetOffsetX"] = sitTargetPos.X; | ||
592 | row["SitTargetOffsetY"] = sitTargetPos.Y; | ||
593 | row["SitTargetOffsetZ"] = sitTargetPos.Z; | ||
594 | |||
595 | LLQuaternion sitTargetOrient = prim.GetSitTargetOrientationLL(); | ||
596 | row["SitTargetOrientW"] = sitTargetOrient.W; | ||
597 | row["SitTargetOrientX"] = sitTargetOrient.X; | ||
598 | row["SitTargetOrientY"] = sitTargetOrient.Y; | ||
599 | row["SitTargetOrientZ"] = sitTargetOrient.Z; | ||
600 | } | ||
601 | catch (System.Exception) | ||
602 | { | ||
603 | // TODO: Add Sit Target Rows! | ||
604 | } | ||
605 | |||
560 | } | 606 | } |
561 | 607 | ||
562 | private PrimitiveBaseShape buildShape(DataRow row) | 608 | private PrimitiveBaseShape buildShape(DataRow row) |
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 | ||