diff options
author | Sean Dague | 2007-08-09 23:51:26 +0000 |
---|---|---|
committer | Sean Dague | 2007-08-09 23:51:26 +0000 |
commit | 6063d2ce5fc8bae2940f751e80fd821b9e0b2a3e (patch) | |
tree | 083f96a8ac2b7da9b796e430a7980cf3b6020393 | |
parent | comment out load from sqlite as this blows up on object creation right now. (diff) | |
download | opensim-SC_OLD-6063d2ce5fc8bae2940f751e80fd821b9e0b2a3e.zip opensim-SC_OLD-6063d2ce5fc8bae2940f751e80fd821b9e0b2a3e.tar.gz opensim-SC_OLD-6063d2ce5fc8bae2940f751e80fd821b9e0b2a3e.tar.bz2 opensim-SC_OLD-6063d2ce5fc8bae2940f751e80fd821b9e0b2a3e.tar.xz |
Couldn't leave this one alone. Data is now flowing both ways in
sqlite *but* isn't being added back to the scene on load because
some information (like rootpart) isn't currently exposed enough
to save/restore, and I don't want to change the SceneObjectGroup
definition without MW around to discuss.
A couple of minor changes on the object interface for SceneObjectGroup
and tweaks to this class, and we have persistant prims again.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | 151 |
1 files changed, 79 insertions, 72 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 0cb3bf3..66ca56d 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -11,6 +11,7 @@ using OpenSim.Framework.Types; | |||
11 | using libsecondlife; | 11 | using libsecondlife; |
12 | 12 | ||
13 | using System.Data; | 13 | using System.Data; |
14 | using System.Data.SqlTypes; | ||
14 | // Yes, this won't compile on MS, need to deal with that later | 15 | // Yes, this won't compile on MS, need to deal with that later |
15 | using Mono.Data.SqliteClient; | 16 | using Mono.Data.SqliteClient; |
16 | 17 | ||
@@ -244,57 +245,59 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
244 | // interesting has to be done to actually get these values | 245 | // interesting has to be done to actually get these values |
245 | // back out. Not enough time to figure it out yet. | 246 | // back out. Not enough time to figure it out yet. |
246 | SceneObjectPart prim = new SceneObjectPart(); | 247 | SceneObjectPart prim = new SceneObjectPart(); |
247 | prim.UUID = new LLUUID((string)row["UUID"]); | 248 | prim.UUID = new LLUUID((String)row["UUID"]); |
248 | prim.ParentID = (uint)row["ParentID"]; | 249 | // explicit conversion of integers is required, which sort |
249 | prim.CreationDate = (int)row["CreationDate"]; | 250 | // of sucks. No idea if there is a shortcut here or not. |
250 | prim.PartName = (string)row["Name"]; | 251 | prim.ParentID = Convert.ToUInt32(row["ParentID"]); |
252 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); | ||
253 | prim.PartName = (String)row["Name"]; | ||
251 | // various text fields | 254 | // various text fields |
252 | prim.Text = (string)row["Text"]; | 255 | prim.Text = (String)row["Text"]; |
253 | prim.Description = (string)row["Description"]; | 256 | prim.Description = (String)row["Description"]; |
254 | prim.SitName = (string)row["SitName"]; | 257 | prim.SitName = (String)row["SitName"]; |
255 | prim.TouchName = (string)row["TouchName"]; | 258 | prim.TouchName = (String)row["TouchName"]; |
256 | // permissions | 259 | // permissions |
257 | prim.CreatorID = new LLUUID((string)row["CreatorID"]); | 260 | prim.CreatorID = new LLUUID((String)row["CreatorID"]); |
258 | prim.OwnerID = new LLUUID((string)row["OwnerID"]); | 261 | prim.OwnerID = new LLUUID((String)row["OwnerID"]); |
259 | prim.GroupID = new LLUUID((string)row["GroupID"]); | 262 | prim.GroupID = new LLUUID((String)row["GroupID"]); |
260 | prim.LastOwnerID = new LLUUID((string)row["LastOwnerID"]); | 263 | prim.LastOwnerID = new LLUUID((String)row["LastOwnerID"]); |
261 | prim.OwnerMask = (uint)row["OwnerMask"]; | 264 | prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); |
262 | prim.NextOwnerMask = (uint)row["NextOwnerMask"]; | 265 | prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); |
263 | prim.GroupMask = (uint)row["GroupMask"]; | 266 | prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); |
264 | prim.EveryoneMask = (uint)row["EveryoneMask"]; | 267 | prim.EveryoneMask = Convert.ToUInt32(row["EveryoneMask"]); |
265 | prim.BaseMask = (uint)row["BaseMask"]; | 268 | prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); |
266 | // vectors | 269 | // vectors |
267 | prim.OffsetPosition = new LLVector3( | 270 | prim.OffsetPosition = new LLVector3( |
268 | (float)row["PositionX"], | 271 | Convert.ToSingle(row["PositionX"]), |
269 | (float)row["PositionY"], | 272 | Convert.ToSingle(row["PositionY"]), |
270 | (float)row["PositionZ"] | 273 | Convert.ToSingle(row["PositionZ"]) |
271 | ); | 274 | ); |
272 | prim.GroupPosition = new LLVector3( | 275 | prim.GroupPosition = new LLVector3( |
273 | (float)row["GroupPositionX"], | 276 | Convert.ToSingle(row["GroupPositionX"]), |
274 | (float)row["GroupPositionY"], | 277 | Convert.ToSingle(row["GroupPositionY"]), |
275 | (float)row["GroupPositionZ"] | 278 | Convert.ToSingle(row["GroupPositionZ"]) |
276 | ); | 279 | ); |
277 | prim.Velocity = new LLVector3( | 280 | prim.Velocity = new LLVector3( |
278 | (float)row["VelocityX"], | 281 | Convert.ToSingle(row["VelocityX"]), |
279 | (float)row["VelocityY"], | 282 | Convert.ToSingle(row["VelocityY"]), |
280 | (float)row["VelocityZ"] | 283 | Convert.ToSingle(row["VelocityZ"]) |
281 | ); | 284 | ); |
282 | prim.AngularVelocity = new LLVector3( | 285 | prim.AngularVelocity = new LLVector3( |
283 | (float)row["AngularVelocityX"], | 286 | Convert.ToSingle(row["AngularVelocityX"]), |
284 | (float)row["AngularVelocityY"], | 287 | Convert.ToSingle(row["AngularVelocityY"]), |
285 | (float)row["AngularVelocityZ"] | 288 | Convert.ToSingle(row["AngularVelocityZ"]) |
286 | ); | 289 | ); |
287 | prim.Acceleration = new LLVector3( | 290 | prim.Acceleration = new LLVector3( |
288 | (float)row["AccelerationX"], | 291 | Convert.ToSingle(row["AccelerationX"]), |
289 | (float)row["AccelerationY"], | 292 | Convert.ToSingle(row["AccelerationY"]), |
290 | (float)row["AccelerationZ"] | 293 | Convert.ToSingle(row["AccelerationZ"]) |
291 | ); | 294 | ); |
292 | // quaternions | 295 | // quaternions |
293 | prim.RotationOffset = new LLQuaternion( | 296 | prim.RotationOffset = new LLQuaternion( |
294 | (float)row["RotationX"], | 297 | Convert.ToSingle(row["RotationX"]), |
295 | (float)row["RotationY"], | 298 | Convert.ToSingle(row["RotationY"]), |
296 | (float)row["RotationZ"], | 299 | Convert.ToSingle(row["RotationZ"]), |
297 | (float)row["RotationW"] | 300 | Convert.ToSingle(row["RotationW"]) |
298 | ); | 301 | ); |
299 | return prim; | 302 | return prim; |
300 | } | 303 | } |
@@ -347,34 +350,34 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
347 | { | 350 | { |
348 | PrimitiveBaseShape s = new PrimitiveBaseShape(); | 351 | PrimitiveBaseShape s = new PrimitiveBaseShape(); |
349 | s.Scale = new LLVector3( | 352 | s.Scale = new LLVector3( |
350 | (float)row["ScaleX"], | 353 | Convert.ToSingle(row["ScaleX"]), |
351 | (float)row["ScaleY"], | 354 | Convert.ToSingle(row["ScaleY"]), |
352 | (float)row["ScaleZ"] | 355 | Convert.ToSingle(row["ScaleZ"]) |
353 | ); | 356 | ); |
354 | // paths | 357 | // paths |
355 | s.PCode = (byte)row["PCode"]; | 358 | s.PCode = Convert.ToByte(row["PCode"]); |
356 | s.PathBegin = (ushort)row["PathBegin"]; | 359 | s.PathBegin = Convert.ToUInt16(row["PathBegin"]); |
357 | s.PathEnd = (ushort)row["PathEnd"]; | 360 | s.PathEnd = Convert.ToUInt16(row["PathEnd"]); |
358 | s.PathScaleX = (byte)row["PathScaleX"]; | 361 | s.PathScaleX = Convert.ToByte(row["PathScaleX"]); |
359 | s.PathScaleY = (byte)row["PathScaleY"]; | 362 | s.PathScaleY = Convert.ToByte(row["PathScaleY"]); |
360 | s.PathShearX = (byte)row["PathShearX"]; | 363 | s.PathShearX = Convert.ToByte(row["PathShearX"]); |
361 | s.PathShearY = (byte)row["PathShearY"]; | 364 | s.PathShearY = Convert.ToByte(row["PathShearY"]); |
362 | s.PathSkew = (sbyte)row["PathSkew"]; | 365 | s.PathSkew = Convert.ToSByte(row["PathSkew"]); |
363 | s.PathCurve = (byte)row["PathCurve"]; | 366 | s.PathCurve = Convert.ToByte(row["PathCurve"]); |
364 | s.PathRadiusOffset = (sbyte)row["PathRadiusOffset"]; | 367 | s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]); |
365 | s.PathRevolutions = (byte)row["PathRevolutions"]; | 368 | s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]); |
366 | s.PathTaperX = (sbyte)row["PathTaperX"]; | 369 | s.PathTaperX = Convert.ToSByte(row["PathTaperX"]); |
367 | s.PathTaperY = (sbyte)row["PathTaperY"]; | 370 | s.PathTaperY = Convert.ToSByte(row["PathTaperY"]); |
368 | s.PathTwist = (sbyte)row["PathTwist"]; | 371 | s.PathTwist = Convert.ToSByte(row["PathTwist"]); |
369 | s.PathTwistBegin = (sbyte)row["PathTwistBegin"]; | 372 | s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]); |
370 | // profile | 373 | // profile |
371 | s.ProfileBegin = (ushort)row["ProfileBegin"]; | 374 | s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]); |
372 | s.ProfileEnd = (ushort)row["ProfileEnd"]; | 375 | s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); |
373 | s.ProfileCurve = (byte)row["ProfileCurve"]; | 376 | s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); |
374 | s.ProfileHollow = (byte)row["ProfileHollow"]; | 377 | s.ProfileHollow = Convert.ToByte(row["ProfileHollow"]); |
375 | // text TODO: this isn't right] = but I'm not sure the right | 378 | // text TODO: this isn't right] = but I'm not sure the right |
376 | // way to specify this as a blob atm | 379 | // way to specify this as a blob atm |
377 | s.TextureEntry = (byte[])row["Texture"]; | 380 | // s.TextureEntry = (byte[])row["Texture"]; |
378 | return s; | 381 | return s; |
379 | } | 382 | } |
380 | 383 | ||
@@ -464,19 +467,23 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
464 | DataTable shapes = ds.Tables["primshapes"]; | 467 | DataTable shapes = ds.Tables["primshapes"]; |
465 | 468 | ||
466 | // This only supports 1 prim per SceneObjectGroup. Need to fix later | 469 | // This only supports 1 prim per SceneObjectGroup. Need to fix later |
467 | // foreach (DataRow primRow in prims.Rows) | 470 | foreach (DataRow primRow in prims.Rows) |
468 | // { | 471 | { |
469 | // SceneObjectGroup group = new SceneObjectGroup(); | 472 | SceneObjectGroup group = new SceneObjectGroup(); |
470 | // SceneObjectPart prim = buildPrim(primRow); | 473 | SceneObjectPart prim = buildPrim(primRow); |
471 | // DataRow shapeRow = shapes.Rows.Find(prim.UUID); | 474 | DataRow shapeRow = shapes.Rows.Find(prim.UUID); |
472 | // if (shapeRow != null) { | 475 | if (shapeRow != null) { |
473 | // prim.Shape = buildShape(shapeRow); | 476 | prim.Shape = buildShape(shapeRow); |
474 | // } | 477 | } |
475 | // group.Children.Add(prim.UUID, prim); | 478 | group.Children.Add(prim.UUID, prim); |
476 | // retvals.Add(group); | 479 | // TODO: there are a couple of known issues to get this to work |
477 | // } | 480 | // * While we can add Children, we can't set the root part (or |
478 | 481 | // or even figure out which should be the root part) | |
479 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + " objects"); | 482 | // * region handle may need to be persisted, it isn't now |
483 | // retvals.Add(group); | ||
484 | } | ||
485 | |||
486 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + prims.Rows.Count + " objects"); | ||
480 | 487 | ||
481 | return retvals; | 488 | return retvals; |
482 | } | 489 | } |