From 409e7262df255649de687eec828d9ef476edc03b Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 30 Oct 2008 12:56:04 +0000 Subject: 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 --- OpenSim/Data/MySQL/MySQLRegionData.cs | 36 ++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'OpenSim/Data/MySQL') 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 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); m_log.Info("[REGION DB]: " + "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); - + + // First, create all groups foreach (DataRow primRow in primsForRegion) { try @@ -422,11 +423,33 @@ namespace OpenSim.Data.MySQL } group.AddPart(prim); group.RootPart = prim; - createdObjects.Add(group.UUID, group); retvals.Add(group); } - else + LoadItems(prim); + } + catch (Exception e) + { + m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); + m_log.Info("[REGION DB]: " + e.ToString()); + foreach (DataColumn col in prims.Columns) + { + m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); + } + } + } + + // Now fill the groups with part data + foreach (DataRow primRow in primsForRegion) + { + try + { + string uuid = (string) primRow["UUID"]; + string objID = (string) primRow["SceneGroupID"]; + + SceneObjectPart prim = buildPrim(primRow); + + if (uuid != objID) //is new SceneObjectGroup ? { DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); if (shapeRow != null) @@ -441,9 +464,8 @@ namespace OpenSim.Data.MySQL } createdObjects[new UUID(objID)].AddPart(prim); } - - LoadItems(prim); - } + LoadItems(prim); + } catch (Exception e) { m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); @@ -473,7 +495,7 @@ namespace OpenSim.Data.MySQL String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); DataRow[] dbItemRows = dbItems.Select(sql); - + Console.WriteLine("dbItemRows MYSQL Length: {0}",dbItemRows.Length); IList inventory = new List(); foreach (DataRow row in dbItemRows) -- cgit v1.1