aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteRegionData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteRegionData.cs')
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs42
1 files changed, 34 insertions, 8 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 812367d..9ddab55 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -412,7 +412,7 @@ namespace OpenSim.Data.SQLite
412 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); 412 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent);
413 m_log.Info("[REGION DB]: " + 413 m_log.Info("[REGION DB]: " +
414 "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); 414 "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
415 415 // First, create all groups
416 foreach (DataRow primRow in primsForRegion) 416 foreach (DataRow primRow in primsForRegion)
417 { 417 {
418 try 418 try
@@ -438,11 +438,32 @@ namespace OpenSim.Data.SQLite
438 } 438 }
439 group.AddPart(prim); 439 group.AddPart(prim);
440 group.RootPart = prim; 440 group.RootPart = prim;
441 441 Console.WriteLine("The Object UUID is {0}",prim.UUID);
442 createdObjects.Add(group.UUID, group); 442 createdObjects.Add(group.UUID, group);
443 retvals.Add(group); 443 retvals.Add(group);
444 } 444 }
445 else 445 LoadItems(prim);
446 }
447 catch (Exception e)
448 {
449 m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows");
450 m_log.Info("[REGION DB]: " + e.ToString());
451 foreach (DataColumn col in prims.Columns)
452 {
453 m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
454 }
455 }
456 }
457 // Now fill the groups with part data
458 foreach (DataRow primRow in primsForRegion)
459 {
460 try
461 {
462 SceneObjectPart prim = null;
463
464 string uuid = (string) primRow["UUID"];
465 string objID = (string) primRow["SceneGroupID"];
466 if (uuid != objID) //is new SceneObjectGroup ?
446 { 467 {
447 prim = buildPrim(primRow); 468 prim = buildPrim(primRow);
448 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); 469 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
@@ -456,14 +477,14 @@ namespace OpenSim.Data.SQLite
456 "[REGION DB]: No shape found for prim in storage, so setting default box shape"); 477 "[REGION DB]: No shape found for prim in storage, so setting default box shape");
457 prim.Shape = PrimitiveBaseShape.Default; 478 prim.Shape = PrimitiveBaseShape.Default;
458 } 479 }
480 Console.WriteLine("Version2: The Object UUID is {0}",prim.UUID);
459 createdObjects[new UUID(objID)].AddPart(prim); 481 createdObjects[new UUID(objID)].AddPart(prim);
460 } 482 }
461
462 LoadItems(prim); 483 LoadItems(prim);
463 } 484 }
464 catch (Exception e) 485 catch (Exception e)
465 { 486 {
466 m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); 487 m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows");
467 m_log.Info("[REGION DB]: " + e.ToString()); 488 m_log.Info("[REGION DB]: " + e.ToString());
468 foreach (DataColumn col in prims.Columns) 489 foreach (DataColumn col in prims.Columns)
469 { 490 {
@@ -482,16 +503,21 @@ namespace OpenSim.Data.SQLite
482 private void LoadItems(SceneObjectPart prim) 503 private void LoadItems(SceneObjectPart prim)
483 { 504 {
484 //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); 505 //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
485 506
486 DataTable dbItems = ds.Tables["primitems"]; 507 DataTable dbItems = ds.Tables["primitems"];
487 508 //return; POINT OF FAILURE!!! BELOW THIS LINE FAILS
509 Console.WriteLine("dbItems: {0} and the prim is: {1}, UUID {2}",dbItems,prim.Name,prim.UUID);
488 String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); 510 String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
511 //string sql = "primID = '" + prim.UUID.ToString() + "'";
489 DataRow[] dbItemRows = dbItems.Select(sql); 512 DataRow[] dbItemRows = dbItems.Select(sql);
490 513 Console.WriteLine("dbItemRows Length: {0}",dbItemRows.Length);
514 if (dbItemRows.Length == 0)
515 return;
491 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 516 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
492 517
493 foreach (DataRow row in dbItemRows) 518 foreach (DataRow row in dbItemRows)
494 { 519 {
520 Console.WriteLine("Inside the foreach");
495 TaskInventoryItem item = buildItem(row); 521 TaskInventoryItem item = buildItem(row);
496 inventory.Add(item); 522 inventory.Add(item);
497 523