diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | 111 |
1 files changed, 59 insertions, 52 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index 50623df..cadd9fc 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | |||
@@ -215,77 +215,84 @@ namespace OpenSim.Framework.Data.MySQL | |||
215 | DataTable prims = m_primTable; | 215 | DataTable prims = m_primTable; |
216 | DataTable shapes = m_shapeTable; | 216 | DataTable shapes = m_shapeTable; |
217 | 217 | ||
218 | string byRegion = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'"; | 218 | try |
219 | string orderByParent = "ParentID ASC"; | ||
220 | |||
221 | lock (m_dataSet) | ||
222 | { | 219 | { |
223 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); | 220 | string byRegion = "RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'"; |
224 | MainLog.Instance.Verbose("DATASTORE", | 221 | string orderByParent = "ParentID ASC"; |
225 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | ||
226 | 222 | ||
227 | foreach (DataRow primRow in primsForRegion) | 223 | lock (m_dataSet) |
228 | { | 224 | { |
229 | try | 225 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); |
226 | MainLog.Instance.Verbose("DATASTORE", | ||
227 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | ||
228 | |||
229 | foreach (DataRow primRow in primsForRegion) | ||
230 | { | 230 | { |
231 | string uuid = (string) primRow["UUID"]; | 231 | try |
232 | string objID = (string) primRow["SceneGroupID"]; | ||
233 | |||
234 | SceneObjectPart prim = buildPrim(primRow); | ||
235 | |||
236 | if (uuid == objID) //is new SceneObjectGroup ? | ||
237 | { | 232 | { |
238 | SceneObjectGroup group = new SceneObjectGroup(); | 233 | string uuid = (string)primRow["UUID"]; |
239 | 234 | string objID = (string)primRow["SceneGroupID"]; | |
240 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); | 235 | |
241 | if (shapeRow != null) | 236 | SceneObjectPart prim = buildPrim(primRow); |
237 | |||
238 | if (uuid == objID) //is new SceneObjectGroup ? | ||
242 | { | 239 | { |
243 | prim.Shape = buildShape(shapeRow); | 240 | SceneObjectGroup group = new SceneObjectGroup(); |
241 | |||
242 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); | ||
243 | if (shapeRow != null) | ||
244 | { | ||
245 | prim.Shape = buildShape(shapeRow); | ||
246 | } | ||
247 | else | ||
248 | { | ||
249 | MainLog.Instance.Notice( | ||
250 | "No shape found for prim in storage, so setting default box shape"); | ||
251 | prim.Shape = PrimitiveBaseShape.Default; | ||
252 | } | ||
253 | group.AddPart(prim); | ||
254 | group.RootPart = prim; | ||
255 | |||
256 | createdObjects.Add(group.UUID, group); | ||
257 | retvals.Add(group); | ||
244 | } | 258 | } |
245 | else | 259 | else |
246 | { | 260 | { |
247 | MainLog.Instance.Notice( | 261 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); |
248 | "No shape found for prim in storage, so setting default box shape"); | 262 | if (shapeRow != null) |
249 | prim.Shape = PrimitiveBaseShape.Default; | 263 | { |
264 | prim.Shape = buildShape(shapeRow); | ||
265 | } | ||
266 | else | ||
267 | { | ||
268 | MainLog.Instance.Notice( | ||
269 | "No shape found for prim in storage, so setting default box shape"); | ||
270 | prim.Shape = PrimitiveBaseShape.Default; | ||
271 | } | ||
272 | createdObjects[new LLUUID(objID)].AddPart(prim); | ||
250 | } | 273 | } |
251 | group.AddPart(prim); | ||
252 | group.RootPart = prim; | ||
253 | 274 | ||
254 | createdObjects.Add(group.UUID, group); | 275 | if (persistPrimInventories) |
255 | retvals.Add(group); | ||
256 | } | ||
257 | else | ||
258 | { | ||
259 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); | ||
260 | if (shapeRow != null) | ||
261 | { | 276 | { |
262 | prim.Shape = buildShape(shapeRow); | 277 | LoadItems(prim); |
263 | } | 278 | } |
264 | else | ||
265 | { | ||
266 | MainLog.Instance.Notice( | ||
267 | "No shape found for prim in storage, so setting default box shape"); | ||
268 | prim.Shape = PrimitiveBaseShape.Default; | ||
269 | } | ||
270 | createdObjects[new LLUUID(objID)].AddPart(prim); | ||
271 | } | 279 | } |
272 | 280 | catch (Exception e) | |
273 | if (persistPrimInventories) | ||
274 | { | ||
275 | LoadItems(prim); | ||
276 | } | ||
277 | } | ||
278 | catch (Exception e) | ||
279 | { | ||
280 | MainLog.Instance.Error("DATASTORE", "Failed create prim object, exception and data follows"); | ||
281 | MainLog.Instance.Verbose("DATASTORE", e.ToString()); | ||
282 | foreach (DataColumn col in prims.Columns) | ||
283 | { | 281 | { |
284 | MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]); | 282 | MainLog.Instance.Error("DATASTORE", "Failed create prim object, exception and data follows"); |
283 | MainLog.Instance.Verbose("DATASTORE", e.ToString()); | ||
284 | foreach (DataColumn col in prims.Columns) | ||
285 | { | ||
286 | MainLog.Instance.Verbose("DATASTORE", "Col: " + col.ColumnName + " => " + primRow[col]); | ||
287 | } | ||
285 | } | 288 | } |
286 | } | 289 | } |
287 | } | 290 | } |
288 | } | 291 | } |
292 | catch (Exception ex) | ||
293 | { | ||
294 | MainLog.Instance.Error("DATASTORE", "Exception trying to load prim objects: " + ex.ToString()); | ||
295 | } | ||
289 | return retvals; | 296 | return retvals; |
290 | } | 297 | } |
291 | 298 | ||