From 2b3b1faf6d579c9aa2d81a3fa9fe5dd95364fa27 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 28 Aug 2007 15:33:22 +0000 Subject: use order by ParentID to ensure root prims are selected first --- .../MonoSqliteDataStore.cs | 73 +++++++++++----------- 1 file changed, 38 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 1882c55..86df632 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs @@ -129,53 +129,56 @@ namespace OpenSim.DataStore.MonoSqliteStorage DataTable shapes = ds.Tables["primshapes"]; string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'"; - DataRow[] primsForRegion = prims.Select(byRegion); + string orderByParent = "ParentID ASC"; + DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); MainLog.Instance.Verbose("DATASTORE", "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); foreach (DataRow primRow in primsForRegion) { - string uuid = (string)primRow["UUID"]; - string objID = (string)primRow["SceneGroupID"]; - if (uuid == objID) //is new SceneObjectGroup ? - { - SceneObjectGroup group = new SceneObjectGroup(); - SceneObjectPart prim = buildPrim(primRow); - DataRow shapeRow = shapes.Rows.Find(prim.UUID); - if (shapeRow != null) + try { + string uuid = (string)primRow["UUID"]; + string objID = (string)primRow["SceneGroupID"]; + if (uuid == objID) //is new SceneObjectGroup ? { - prim.Shape = buildShape(shapeRow); + SceneObjectGroup group = new SceneObjectGroup(); + SceneObjectPart prim = buildPrim(primRow); + DataRow shapeRow = shapes.Rows.Find(prim.UUID); + if (shapeRow != null) + { + prim.Shape = buildShape(shapeRow); + } + else + { + Console.WriteLine("No shape found for prim in storage, so setting default box shape"); + prim.Shape = BoxShape.Default; + } + group.AddPart(prim); + group.RootPart = prim; + + createdObjects.Add(group.UUID, group); + retvals.Add(group); } else { - Console.WriteLine("No shape found for prim in storage, so setting default box shape"); - prim.Shape = BoxShape.Default; + SceneObjectPart prim = buildPrim(primRow); + DataRow shapeRow = shapes.Rows.Find(prim.UUID); + if (shapeRow != null) + { + prim.Shape = buildShape(shapeRow); + } + else + { + Console.WriteLine("No shape found for prim in storage, so setting default box shape"); + prim.Shape = BoxShape.Default; + } + createdObjects[new LLUUID(objID)].AddPart(prim); } - group.AddPart(prim); - group.RootPart = prim; - - createdObjects.Add(group.UUID, group); - retvals.Add(group); - } - else - { - SceneObjectPart prim = buildPrim(primRow); - DataRow shapeRow = shapes.Rows.Find(prim.UUID); - if (shapeRow != null) - { - prim.Shape = buildShape(shapeRow); + } catch(Exception) { + foreach (DataColumn col in prims.Columns) { + MainLog.Instance.Verbose("Col: " + col.ColumnName + " => " + primRow[col]); } - else - { - Console.WriteLine("No shape found for prim in storage, so setting default box shape"); - prim.Shape = BoxShape.Default; - } - - createdObjects[new LLUUID(objID)].AddPart(prim); - - } } - MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + prims.Rows.Count + " primitives"); return retvals; -- cgit v1.1