diff options
-rw-r--r-- | OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 9d0a043..6400d29 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -117,8 +117,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
117 | private Dictionary<string, DbType> createShapeDataDefs() | 117 | private Dictionary<string, DbType> createShapeDataDefs() |
118 | { | 118 | { |
119 | Dictionary<string, DbType> data = new Dictionary<string, DbType>(); | 119 | Dictionary<string, DbType> data = new Dictionary<string, DbType>(); |
120 | data.Add("id", DbType.Int32); | 120 | data.Add("UUID", DbType.String); |
121 | data.Add("prim_id", DbType.Int32); | ||
122 | // shape is an enum | 121 | // shape is an enum |
123 | data.Add("Shape", DbType.Int32); | 122 | data.Add("Shape", DbType.Int32); |
124 | // vectors | 123 | // vectors |
@@ -215,32 +214,33 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
215 | da.DeleteCommand = delete; | 214 | da.DeleteCommand = delete; |
216 | } | 215 | } |
217 | 216 | ||
218 | private void StoreSceneObject(SceneObject obj) | 217 | private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) |
219 | { | 218 | { |
219 | Dictionary<string, DbType> shapeDataDefs = createShapeDataDefs(); | ||
220 | 220 | ||
221 | } | 221 | da.InsertCommand = createInsertCommand("primshapes", shapeDataDefs); |
222 | da.InsertCommand.Connection = conn; | ||
222 | 223 | ||
223 | public void StoreObject(AllNewSceneObjectPart2 obj) | 224 | da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", shapeDataDefs); |
224 | { | 225 | da.UpdateCommand.Connection = conn; |
225 | // TODO: Serializing code | ||
226 | DataTable prims = ds.Tables["prims"]; | ||
227 | DataTable shapes = ds.Tables["shapes"]; | ||
228 | |||
229 | |||
230 | 226 | ||
227 | SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); | ||
228 | delete.Parameters.Add(createSqliteParameter("UUID", DbType.String)); | ||
229 | delete.Connection = conn; | ||
230 | da.DeleteCommand = delete; | ||
231 | } | 231 | } |
232 | 232 | ||
233 | private void fillPrimRow(DataRow row, Primitive prim) | 233 | private void fillPrimRow(DataRow row, SceneObjectPart prim) |
234 | { | 234 | { |
235 | row["UUID"] = prim.UUID; | 235 | row["UUID"] = prim.UUID; |
236 | row["CreationDate"] = prim.CreationDate; | 236 | row["CreationDate"] = prim.CreationDate; |
237 | row["Name"] = prim.Name; | 237 | row["Name"] = prim.PartName; |
238 | row["PositionX"] = prim.Pos.X; | 238 | row["PositionX"] = prim.OffsetPosition.X; |
239 | row["PositionY"] = prim.Pos.Y; | 239 | row["PositionY"] = prim.OffsetPosition.Y; |
240 | row["PositionZ"] = prim.Pos.Z; | 240 | row["PositionZ"] = prim.OffsetPosition.Z; |
241 | } | 241 | } |
242 | 242 | ||
243 | private void addPrim(Primitive prim) | 243 | private void addPrim(SceneObjectPart prim) |
244 | { | 244 | { |
245 | DataTable prims = ds.Tables["prims"]; | 245 | DataTable prims = ds.Tables["prims"]; |
246 | DataTable shapes = ds.Tables["shapes"]; | 246 | DataTable shapes = ds.Tables["shapes"]; |
@@ -248,16 +248,16 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
248 | DataRow row = prims.Rows.Find(prim.UUID); | 248 | DataRow row = prims.Rows.Find(prim.UUID); |
249 | if (row == null) { | 249 | if (row == null) { |
250 | row = prims.NewRow(); | 250 | row = prims.NewRow(); |
251 | fillPrimRow(row, prim); | 251 | // fillPrimRow(row, prim); |
252 | prims.Rows.Add(row); | 252 | prims.Rows.Add(row); |
253 | } else { | 253 | } else { |
254 | fillPrimRow(row, prim); | 254 | fillPrimRow(row, prim); |
255 | } | 255 | } |
256 | } | 256 | } |
257 | 257 | ||
258 | public void StoreObject(SceneObject obj) | 258 | public void StoreObject(SceneObjectGroup obj) |
259 | { | 259 | { |
260 | foreach (Primitive prim in obj.Children.Values) | 260 | foreach (SceneObjectPart prim in obj.Children.Values) |
261 | { | 261 | { |
262 | addPrim(prim); | 262 | addPrim(prim); |
263 | } | 263 | } |
@@ -272,9 +272,9 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
272 | // TODO: remove code | 272 | // TODO: remove code |
273 | } | 273 | } |
274 | 274 | ||
275 | public List<SceneObject> LoadObjects() | 275 | public List<SceneObjectGroup> LoadObjects() |
276 | { | 276 | { |
277 | List<SceneObject> retvals = new List<SceneObject>(); | 277 | List<SceneObjectGroup> retvals = new List<SceneObjectGroup>(); |
278 | 278 | ||
279 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + " objects"); | 279 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + " objects"); |
280 | 280 | ||