diff options
author | Sean Dague | 2007-08-09 01:54:01 +0000 |
---|---|---|
committer | Sean Dague | 2007-08-09 01:54:01 +0000 |
commit | d746813130a1aaefe5920a15e93c3a2f7345c8d0 (patch) | |
tree | a751efa99ffd27b468891fae21e971c46e4a2bfd | |
parent | Commit in the changes for all the parameter bindings for prims (diff) | |
download | opensim-SC_OLD-d746813130a1aaefe5920a15e93c3a2f7345c8d0.zip opensim-SC_OLD-d746813130a1aaefe5920a15e93c3a2f7345c8d0.tar.gz opensim-SC_OLD-d746813130a1aaefe5920a15e93c3a2f7345c8d0.tar.bz2 opensim-SC_OLD-d746813130a1aaefe5920a15e93c3a2f7345c8d0.tar.xz |
intermediate checkin of code that compiles before I do something
stupid and nuke all this work.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | 91 |
1 files changed, 87 insertions, 4 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index e408481..0a73880 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -21,6 +21,9 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
21 | { | 21 | { |
22 | private const string primSelect = "select * from prims"; | 22 | private const string primSelect = "select * from prims"; |
23 | private const string shapeSelect = "select * from primshapes"; | 23 | private const string shapeSelect = "select * from primshapes"; |
24 | |||
25 | private Dictionary<string, DbType> primDataDefs; | ||
26 | private Dictionary<string, DbType> shapeDataDefs; | ||
24 | 27 | ||
25 | private DataSet ds; | 28 | private DataSet ds; |
26 | private SqliteDataAdapter primDa; | 29 | private SqliteDataAdapter primDa; |
@@ -68,8 +71,62 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
68 | return param; | 71 | return param; |
69 | } | 72 | } |
70 | 73 | ||
74 | private Dictionary<string, DbType> createPrimDataDefs() | ||
75 | { | ||
76 | Dictionary<string, DbType> data = new Dictionary<string, DbType>(); | ||
77 | data.Add("UUID", DbType.String); | ||
78 | data.Add("ParentID", DbType.Int32); | ||
79 | data.Add("CreationDate", DbType.Int32); | ||
80 | data.Add("Name", DbType.String); | ||
81 | // various text fields | ||
82 | data.Add("Text", DbType.String); | ||
83 | data.Add("Description", DbType.String); | ||
84 | data.Add("SitName", DbType.String); | ||
85 | data.Add("TouchName", DbType.String); | ||
86 | // permissions | ||
87 | data.Add("CreatorID", DbType.String); | ||
88 | data.Add("OwnerID", DbType.String); | ||
89 | data.Add("GroupID", DbType.String); | ||
90 | data.Add("LastOwnerID", DbType.String); | ||
91 | data.Add("OwnerMask", DbType.Int32); | ||
92 | data.Add("NextOwnerMask", DbType.Int32); | ||
93 | data.Add("GroupMask", DbType.Int32); | ||
94 | data.Add("EveryoneMask", DbType.Int32); | ||
95 | data.Add("BaseMask", DbType.Int32); | ||
96 | // vectors | ||
97 | data.Add("PositionX", DbType.Double); | ||
98 | data.Add("PositionY", DbType.Double); | ||
99 | data.Add("PositionZ", DbType.Double); | ||
100 | data.Add("VelocityX", DbType.Double); | ||
101 | data.Add("VelocityY", DbType.Double); | ||
102 | data.Add("VelocityZ", DbType.Double); | ||
103 | data.Add("AngularVelocityX", DbType.Double); | ||
104 | data.Add("AngularVelocityY", DbType.Double); | ||
105 | data.Add("AngularVelocityZ", DbType.Double); | ||
106 | data.Add("AccelerationX", DbType.Double); | ||
107 | data.Add("AccelerationY", DbType.Double); | ||
108 | data.Add("AccelerationZ", DbType.Double); | ||
109 | // quaternions | ||
110 | data.Add("RotationX", DbType.Double); | ||
111 | data.Add("RotationY", DbType.Double); | ||
112 | data.Add("RotationZ", DbType.Double); | ||
113 | data.Add("RotationW", DbType.Double); | ||
114 | return data; | ||
115 | } | ||
116 | |||
117 | private SqliteCommand createInsertCommand(Dictionary<string, DbType> defs) | ||
118 | { | ||
119 | SqliteCommand cmd = new SqliteCommand(); | ||
120 | string sql = "insert into prims("; | ||
121 | |||
122 | return cmd; | ||
123 | } | ||
124 | |||
71 | private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) | 125 | private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) |
72 | { | 126 | { |
127 | Dictionary<string, DbType> primDataDefs = createPrimDataDefs(); | ||
128 | |||
129 | da.InsertCommand = createInsertCommand(primDataDefs); | ||
73 | /* | 130 | /* |
74 | * Create all the bound parameters. Try to keep these in the same order | 131 | * Create all the bound parameters. Try to keep these in the same order |
75 | * as the sql file, with comments in the same places, or your head will probably | 132 | * as the sql file, with comments in the same places, or your head will probably |
@@ -119,14 +176,40 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
119 | 176 | ||
120 | SqliteCommand insert = | 177 | SqliteCommand insert = |
121 | new SqliteCommand("insert into prims(" + | 178 | new SqliteCommand("insert into prims(" + |
122 | "UUID, CreationDate, Name, PositionX, PositionY, PositionZ" + | 179 | "UUID, ParentID, CreationDate, Name, " + |
123 | ") values(:UUID, :CreationDate, :Name, :PositionX, :PositionY, :PositionZ)"); | 180 | "Text, Description, SitName, TouchName, " + |
181 | "CreatorID, OwnerID, GroupID, LastOwnerID, " + | ||
182 | "OwnerMask, NextOwnerMask, GroupMask, EveryoneMask, BaseMask, " + | ||
183 | "PositionX, PositionY, PositionZ, " + | ||
184 | "VelocityX, VelocityY, VelocityZ, " + | ||
185 | "AngularVelocityX, AngularVelocityY, AngularVelocityZ, " + | ||
186 | "AccelerationX, AccelerationY, AccelerationZ, " + | ||
187 | "RotationX, RotationY, RotationZ, RotationW" + | ||
188 | ") values (" + | ||
189 | ":UUID, :ParentID, :CreationDate, :Name, " + | ||
190 | ":Text, :Description, :SitName, :TouchName, " + | ||
191 | ":CreatorID, :OwnerID, :GroupID, :LastOwnerID, " + | ||
192 | ":OwnerMask, :NextOwnerMask, :GroupMask, :EveryoneMask, :BaseMask, " + | ||
193 | ":PositionX, :PositionY, :PositionZ, " + | ||
194 | ":VelocityX, :VelocityY, :VelocityZ, " + | ||
195 | ":AngularVelocityX, :AngularVelocityY, :AngularVelocityZ, " + | ||
196 | ":AccelerationX, :AccelerationY, :AccelerationZ, " + | ||
197 | ":RotationX, :RotationY, :RotationZ, :RotationW)"); | ||
198 | |||
124 | insert.Connection = conn; | 199 | insert.Connection = conn; |
125 | 200 | ||
126 | SqliteCommand update = | 201 | SqliteCommand update = |
127 | new SqliteCommand("update prims set " + | 202 | new SqliteCommand("update prims set " + |
128 | "UUID = :UUID, CreationDate = :CreationDate, Name = :Name, PositionX = :PositionX, " + | 203 | "UUID = :UUID, ParentID = :ParentID, CreationDate = :CreationDate, Name = :Name, " + |
129 | "PositionY = :PositionY, PositionZ = :PositionZ where UUID = :UUID"); | 204 | "Text = :Text, Description = :Description, SitName = :SitName, TouchName = :TouchName, " + |
205 | "CreatorID = :CreatorID, OwnerID = :OwnerID, GroupID = :GroupID, LastOwnerID = :LastOwnerID, " + | ||
206 | "OwnerMask = :OwnerMask, NextOwnerMask = :NextOwnerMask, GroupMask = :GroupMask, = :EveryoneMask, = :BaseMask, " + | ||
207 | " = :PositionX, = :PositionY, = :PositionZ, " + | ||
208 | " = :VelocityX, = :VelocityY, = :VelocityZ, " + | ||
209 | " = :AngularVelocityX, = :AngularVelocityY, = :AngularVelocityZ, " + | ||
210 | " = :AccelerationX, = :AccelerationY, = :AccelerationZ, " + | ||
211 | " = :RotationX, = :RotationY, = :RotationZ, = :RotationW " + | ||
212 | "where UUID = :UUID"); | ||
130 | update.Connection = conn; | 213 | update.Connection = conn; |
131 | 214 | ||
132 | delete.Parameters.Add(UUID); | 215 | delete.Parameters.Add(UUID); |