diff options
author | Sean Dague | 2007-08-28 15:33:22 +0000 |
---|---|---|
committer | Sean Dague | 2007-08-28 15:33:22 +0000 |
commit | 2b3b1faf6d579c9aa2d81a3fa9fe5dd95364fa27 (patch) | |
tree | 5f21c952df07d07b786739dde90c21ad4adff9ea | |
parent | Removed last commit, as sdague has also done a fix. (diff) | |
download | opensim-SC-2b3b1faf6d579c9aa2d81a3fa9fe5dd95364fa27.zip opensim-SC-2b3b1faf6d579c9aa2d81a3fa9fe5dd95364fa27.tar.gz opensim-SC-2b3b1faf6d579c9aa2d81a3fa9fe5dd95364fa27.tar.bz2 opensim-SC-2b3b1faf6d579c9aa2d81a3fa9fe5dd95364fa27.tar.xz |
use order by ParentID to ensure root prims are selected first
-rw-r--r-- | OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | 73 |
1 files changed, 38 insertions, 35 deletions
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 | |||
129 | DataTable shapes = ds.Tables["primshapes"]; | 129 | DataTable shapes = ds.Tables["primshapes"]; |
130 | 130 | ||
131 | string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'"; | 131 | string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'"; |
132 | DataRow[] primsForRegion = prims.Select(byRegion); | 132 | string orderByParent = "ParentID ASC"; |
133 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); | ||
133 | MainLog.Instance.Verbose("DATASTORE", "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | 134 | MainLog.Instance.Verbose("DATASTORE", "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); |
134 | 135 | ||
135 | foreach (DataRow primRow in primsForRegion) | 136 | foreach (DataRow primRow in primsForRegion) |
136 | { | 137 | { |
137 | string uuid = (string)primRow["UUID"]; | 138 | try { |
138 | string objID = (string)primRow["SceneGroupID"]; | 139 | string uuid = (string)primRow["UUID"]; |
139 | if (uuid == objID) //is new SceneObjectGroup ? | 140 | string objID = (string)primRow["SceneGroupID"]; |
140 | { | 141 | if (uuid == objID) //is new SceneObjectGroup ? |
141 | SceneObjectGroup group = new SceneObjectGroup(); | ||
142 | SceneObjectPart prim = buildPrim(primRow); | ||
143 | DataRow shapeRow = shapes.Rows.Find(prim.UUID); | ||
144 | if (shapeRow != null) | ||
145 | { | 142 | { |
146 | prim.Shape = buildShape(shapeRow); | 143 | SceneObjectGroup group = new SceneObjectGroup(); |
144 | SceneObjectPart prim = buildPrim(primRow); | ||
145 | DataRow shapeRow = shapes.Rows.Find(prim.UUID); | ||
146 | if (shapeRow != null) | ||
147 | { | ||
148 | prim.Shape = buildShape(shapeRow); | ||
149 | } | ||
150 | else | ||
151 | { | ||
152 | Console.WriteLine("No shape found for prim in storage, so setting default box shape"); | ||
153 | prim.Shape = BoxShape.Default; | ||
154 | } | ||
155 | group.AddPart(prim); | ||
156 | group.RootPart = prim; | ||
157 | |||
158 | createdObjects.Add(group.UUID, group); | ||
159 | retvals.Add(group); | ||
147 | } | 160 | } |
148 | else | 161 | else |
149 | { | 162 | { |
150 | Console.WriteLine("No shape found for prim in storage, so setting default box shape"); | 163 | SceneObjectPart prim = buildPrim(primRow); |
151 | prim.Shape = BoxShape.Default; | 164 | DataRow shapeRow = shapes.Rows.Find(prim.UUID); |
165 | if (shapeRow != null) | ||
166 | { | ||
167 | prim.Shape = buildShape(shapeRow); | ||
168 | } | ||
169 | else | ||
170 | { | ||
171 | Console.WriteLine("No shape found for prim in storage, so setting default box shape"); | ||
172 | prim.Shape = BoxShape.Default; | ||
173 | } | ||
174 | createdObjects[new LLUUID(objID)].AddPart(prim); | ||
152 | } | 175 | } |
153 | group.AddPart(prim); | 176 | } catch(Exception) { |
154 | group.RootPart = prim; | 177 | foreach (DataColumn col in prims.Columns) { |
155 | 178 | MainLog.Instance.Verbose("Col: " + col.ColumnName + " => " + primRow[col]); | |
156 | createdObjects.Add(group.UUID, group); | ||
157 | retvals.Add(group); | ||
158 | } | ||
159 | else | ||
160 | { | ||
161 | SceneObjectPart prim = buildPrim(primRow); | ||
162 | DataRow shapeRow = shapes.Rows.Find(prim.UUID); | ||
163 | if (shapeRow != null) | ||
164 | { | ||
165 | prim.Shape = buildShape(shapeRow); | ||
166 | } | 179 | } |
167 | else | ||
168 | { | ||
169 | Console.WriteLine("No shape found for prim in storage, so setting default box shape"); | ||
170 | prim.Shape = BoxShape.Default; | ||
171 | } | ||
172 | |||
173 | createdObjects[new LLUUID(objID)].AddPart(prim); | ||
174 | |||
175 | |||
176 | } | 180 | } |
177 | } | 181 | } |
178 | |||
179 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + prims.Rows.Count + " primitives"); | 182 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + prims.Rows.Count + " primitives"); |
180 | 183 | ||
181 | return retvals; | 184 | return retvals; |