aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Storage
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Storage')
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs139
1 files changed, 28 insertions, 111 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index 2d52a2a..24a431e 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -52,22 +52,14 @@ namespace OpenSim.DataStore.MonoSqliteStorage
52 // We fill the data set, now we've got copies in memory for the information 52 // We fill the data set, now we've got copies in memory for the information
53 // TODO: see if the linkage actually holds. 53 // TODO: see if the linkage actually holds.
54 // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema"); 54 // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema");
55 TestPrimsTable(conn); 55 TestTables(conn);
56 56
57 ds.Tables.Add(createPrimTable()); 57 ds.Tables.Add(createPrimTable());
58 DataTable prims = ds.Tables["prims"]; 58 primDa.Fill(ds.Tables["prims"]);
59 primDa.Fill(prims);
60 MainLog.Instance.Verbose(ds.GetXmlSchema());
61
62 shapeDa.Fill(ds, "primshapes");
63 ds.AcceptChanges();
64
65 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
66 setupPrimCommands(primDa, conn); 59 setupPrimCommands(primDa, conn);
67 60
68 // shapeDa.FillSchema(ds, SchemaType.Source, "ShapeSchema"); 61 ds.Tables.Add(createShapeTable());
69 DataTable shapes = ds.Tables["primshapes"]; 62 primDa.Fill(ds.Tables["primshapes"]);
70 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] };
71 setupShapeCommands(shapeDa, conn); 63 setupShapeCommands(shapeDa, conn);
72 64
73 return; 65 return;
@@ -642,28 +634,37 @@ namespace OpenSim.DataStore.MonoSqliteStorage
642 } 634 }
643 } 635 }
644 636
645 private bool TestPrimsTable(SqliteConnection conn) 637 private bool TestTables(SqliteConnection conn)
646 { 638 {
647 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); 639 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn);
648 SqliteDataAdapter da = new SqliteDataAdapter(primSelectCmd); 640 SqliteDataAdapter primDa = new SqliteDataAdapter(primSelectCmd);
649 DataSet tmp = new DataSet(); 641 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn);
642 SqliteDataAdapter shapeDa = new SqliteDataAdapter(shapeSelectCmd);
643
644 DataSet tmpDS = new DataSet();
650 try { 645 try {
651 da.Fill(tmp, "prims"); 646 primDa.Fill(tmpDS, "prims");
647 shapeDa.Fill(tmpDS, "primshapes");
652 } catch (Mono.Data.SqliteClient.SqliteSyntaxException) { 648 } catch (Mono.Data.SqliteClient.SqliteSyntaxException) {
653 MainLog.Instance.Verbose("SQLite Database does exist... creating"); 649 MainLog.Instance.Verbose("SQLite Database does exist... creating");
654 InitDB(conn); 650 InitDB(conn);
655 } 651 }
656 652
657 // Dictionary<string, DbType> defs = createPrimDataDefs(); 653 primDa.Fill(tmpDS, "prims");
658 // // da.FillSchema(ds, SchemaType.Mapped, "prims"); 654 shapeDa.Fill(tmpDS, "primshapes");
659 da.Fill(tmp, "prims"); 655
660 MainLog.Instance.Verbose("DATASTORE", "Filled prims..."); 656 foreach (DataColumn col in createPrimTable().Columns) {
661 // DataTable prims = ds.Tables["prims"]; 657 if (! tmpDS.Tables["prims"].Columns.Contains(col.ColumnName) ) {
662 // foreach (DataColumn col in prims.Columns) 658 MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName);
663 // { 659 return false;
664 // MainLog.Instance.Verbose("Found: " + col); 660 }
665 // } 661 }
666 // return true; 662 foreach (DataColumn col in createShapeTable().Columns) {
663 if (! tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName) ) {
664 MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName);
665 return false;
666 }
667 }
667 return true; 668 return true;
668 } 669 }
669 670
@@ -729,54 +730,6 @@ namespace OpenSim.DataStore.MonoSqliteStorage
729 return prims; 730 return prims;
730 } 731 }
731 732
732 private Dictionary<string, DbType> createPrimDataDefs()
733 {
734 Dictionary<string, DbType> data = new Dictionary<string, DbType>();
735 data.Add("UUID", DbType.String);
736 data.Add("ParentID", DbType.Int32);
737 data.Add("CreationDate", DbType.Int32);
738 data.Add("Name", DbType.String);
739 data.Add("SceneGroupID", DbType.String);
740 // various text fields
741 data.Add("Text", DbType.String);
742 data.Add("Description", DbType.String);
743 data.Add("SitName", DbType.String);
744 data.Add("TouchName", DbType.String);
745 // permissions
746 data.Add("CreatorID", DbType.String);
747 data.Add("OwnerID", DbType.String);
748 data.Add("GroupID", DbType.String);
749 data.Add("LastOwnerID", DbType.String);
750 data.Add("OwnerMask", DbType.Int32);
751 data.Add("NextOwnerMask", DbType.Int32);
752 data.Add("GroupMask", DbType.Int32);
753 data.Add("EveryoneMask", DbType.Int32);
754 data.Add("BaseMask", DbType.Int32);
755 // vectors
756 data.Add("PositionX", DbType.Double);
757 data.Add("PositionY", DbType.Double);
758 data.Add("PositionZ", DbType.Double);
759 data.Add("GroupPositionX", DbType.Double);
760 data.Add("GroupPositionY", DbType.Double);
761 data.Add("GroupPositionZ", DbType.Double);
762 data.Add("VelocityX", DbType.Double);
763 data.Add("VelocityY", DbType.Double);
764 data.Add("VelocityZ", DbType.Double);
765 data.Add("AngularVelocityX", DbType.Double);
766 data.Add("AngularVelocityY", DbType.Double);
767 data.Add("AngularVelocityZ", DbType.Double);
768 data.Add("AccelerationX", DbType.Double);
769 data.Add("AccelerationY", DbType.Double);
770 data.Add("AccelerationZ", DbType.Double);
771 // quaternions
772 data.Add("RotationX", DbType.Double);
773 data.Add("RotationY", DbType.Double);
774 data.Add("RotationZ", DbType.Double);
775 data.Add("RotationW", DbType.Double);
776 return data;
777 }
778
779
780 private DataTable createShapeTable() 733 private DataTable createShapeTable()
781 { 734 {
782 DataTable shapes = new DataTable("primshapes"); 735 DataTable shapes = new DataTable("primshapes");
@@ -811,47 +764,11 @@ namespace OpenSim.DataStore.MonoSqliteStorage
811 // text TODO: this isn't right, but I'm not sure the right 764 // text TODO: this isn't right, but I'm not sure the right
812 // way to specify this as a blob atm 765 // way to specify this as a blob atm
813 createCol(shapes, "Texture", typeof(System.Byte[])); 766 createCol(shapes, "Texture", typeof(System.Byte[]));
767 createCol(shapes, "ExtraParams", typeof(System.Byte[]));
814 768
815 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; 769 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] };
816 770
817 return shapes; 771 return shapes;
818 } 772 }
819
820 private Dictionary<string, DbType> createShapeDataDefs()
821 {
822 Dictionary<string, DbType> data = new Dictionary<string, DbType>();
823 data.Add("UUID", DbType.String);
824 // shape is an enum
825 data.Add("Shape", DbType.Int32);
826 // vectors
827 data.Add("ScaleX", DbType.Double);
828 data.Add("ScaleY", DbType.Double);
829 data.Add("ScaleZ", DbType.Double);
830 // paths
831 data.Add("PCode", DbType.Int32);
832 data.Add("PathBegin", DbType.Int32);
833 data.Add("PathEnd", DbType.Int32);
834 data.Add("PathScaleX", DbType.Int32);
835 data.Add("PathScaleY", DbType.Int32);
836 data.Add("PathShearX", DbType.Int32);
837 data.Add("PathShearY", DbType.Int32);
838 data.Add("PathSkew", DbType.Int32);
839 data.Add("PathCurve", DbType.Int32);
840 data.Add("PathRadiusOffset", DbType.Int32);
841 data.Add("PathRevolutions", DbType.Int32);
842 data.Add("PathTaperX", DbType.Int32);
843 data.Add("PathTaperY", DbType.Int32);
844 data.Add("PathTwist", DbType.Int32);
845 data.Add("PathTwistBegin", DbType.Int32);
846 // profile
847 data.Add("ProfileBegin", DbType.Int32);
848 data.Add("ProfileEnd", DbType.Int32);
849 data.Add("ProfileCurve", DbType.Int32);
850 data.Add("ProfileHollow", DbType.Int32);
851 // text TODO: this isn't right, but I'm not sure the right
852 // way to specify this as a blob atm
853 data.Add("Texture", DbType.Binary);
854 return data;
855 }
856 } 773 }
857} 774}