diff options
author | Sean Dague | 2008-10-30 12:56:04 +0000 |
---|---|---|
committer | Sean Dague | 2008-10-30 12:56:04 +0000 |
commit | 409e7262df255649de687eec828d9ef476edc03b (patch) | |
tree | ff631ba12d6eb899abff42ade2c56244485c1a5a /OpenSim/Data/MySQL/MySQLRegionData.cs | |
parent | - Inserted code coverage monocov. To run do nant test-cov. (diff) | |
download | opensim-SC_OLD-409e7262df255649de687eec828d9ef476edc03b.zip opensim-SC_OLD-409e7262df255649de687eec828d9ef476edc03b.tar.gz opensim-SC_OLD-409e7262df255649de687eec828d9ef476edc03b.tar.bz2 opensim-SC_OLD-409e7262df255649de687eec828d9ef476edc03b.tar.xz |
Mid-work, trying to fix region part insertion and retrieval
SQLite reports System NUll Reference, but works, inside
LoadItems, on SQLiteRegionData.cs
From: Arthur Rodrigo S Valadares <arthursv@linux.vnet.ibm.com>
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLRegionData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index ab7e92d..fb08049 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -395,7 +395,8 @@ namespace OpenSim.Data.MySQL | |||
395 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); | 395 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); |
396 | m_log.Info("[REGION DB]: " + | 396 | m_log.Info("[REGION DB]: " + |
397 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | 397 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); |
398 | 398 | ||
399 | // First, create all groups | ||
399 | foreach (DataRow primRow in primsForRegion) | 400 | foreach (DataRow primRow in primsForRegion) |
400 | { | 401 | { |
401 | try | 402 | try |
@@ -422,11 +423,33 @@ namespace OpenSim.Data.MySQL | |||
422 | } | 423 | } |
423 | group.AddPart(prim); | 424 | group.AddPart(prim); |
424 | group.RootPart = prim; | 425 | group.RootPart = prim; |
425 | |||
426 | createdObjects.Add(group.UUID, group); | 426 | createdObjects.Add(group.UUID, group); |
427 | retvals.Add(group); | 427 | retvals.Add(group); |
428 | } | 428 | } |
429 | else | 429 | LoadItems(prim); |
430 | } | ||
431 | catch (Exception e) | ||
432 | { | ||
433 | m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); | ||
434 | m_log.Info("[REGION DB]: " + e.ToString()); | ||
435 | foreach (DataColumn col in prims.Columns) | ||
436 | { | ||
437 | m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); | ||
438 | } | ||
439 | } | ||
440 | } | ||
441 | |||
442 | // Now fill the groups with part data | ||
443 | foreach (DataRow primRow in primsForRegion) | ||
444 | { | ||
445 | try | ||
446 | { | ||
447 | string uuid = (string) primRow["UUID"]; | ||
448 | string objID = (string) primRow["SceneGroupID"]; | ||
449 | |||
450 | SceneObjectPart prim = buildPrim(primRow); | ||
451 | |||
452 | if (uuid != objID) //is new SceneObjectGroup ? | ||
430 | { | 453 | { |
431 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); | 454 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); |
432 | if (shapeRow != null) | 455 | if (shapeRow != null) |
@@ -441,9 +464,8 @@ namespace OpenSim.Data.MySQL | |||
441 | } | 464 | } |
442 | createdObjects[new UUID(objID)].AddPart(prim); | 465 | createdObjects[new UUID(objID)].AddPart(prim); |
443 | } | 466 | } |
444 | 467 | LoadItems(prim); | |
445 | LoadItems(prim); | 468 | } |
446 | } | ||
447 | catch (Exception e) | 469 | catch (Exception e) |
448 | { | 470 | { |
449 | m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); | 471 | m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); |
@@ -473,7 +495,7 @@ namespace OpenSim.Data.MySQL | |||
473 | 495 | ||
474 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); | 496 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); |
475 | DataRow[] dbItemRows = dbItems.Select(sql); | 497 | DataRow[] dbItemRows = dbItems.Select(sql); |
476 | 498 | Console.WriteLine("dbItemRows MYSQL Length: {0}",dbItemRows.Length); | |
477 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); | 499 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); |
478 | 500 | ||
479 | foreach (DataRow row in dbItemRows) | 501 | foreach (DataRow row in dbItemRows) |