diff options
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs index 7d017a6..4ce93e5 100644 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | |||
@@ -232,66 +232,68 @@ namespace OpenSim.Data.MSSQL | |||
232 | /// <param name="regionUUID"></param> | 232 | /// <param name="regionUUID"></param> |
233 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 233 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
234 | { | 234 | { |
235 | _Log.InfoFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); | 235 | lock (obj.Children) |
236 | |||
237 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
238 | { | 236 | { |
239 | conn.Open(); | 237 | _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); |
240 | SqlTransaction transaction = conn.BeginTransaction(); | 238 | |
241 | 239 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | |
242 | try | ||
243 | { | 240 | { |
244 | foreach (SceneObjectPart sceneObjectPart in obj.Children.Values) | 241 | conn.Open(); |
242 | SqlTransaction transaction = conn.BeginTransaction(); | ||
243 | |||
244 | try | ||
245 | { | 245 | { |
246 | //Update prim | 246 | foreach (SceneObjectPart sceneObjectPart in obj.Children.Values) |
247 | using (SqlCommand sqlCommand = conn.CreateCommand()) | ||
248 | { | ||
249 | sqlCommand.Transaction = transaction; | ||
250 | try | ||
251 | { | ||
252 | StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); | ||
253 | } | ||
254 | catch (SqlException sqlEx) | ||
255 | { | ||
256 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); | ||
257 | throw; | ||
258 | } | ||
259 | } | ||
260 | |||
261 | //Update primshapes | ||
262 | using (SqlCommand sqlCommand = conn.CreateCommand()) | ||
263 | { | 247 | { |
264 | sqlCommand.Transaction = transaction; | 248 | //Update prim |
265 | try | 249 | using (SqlCommand sqlCommand = conn.CreateCommand()) |
266 | { | 250 | { |
267 | StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); | 251 | sqlCommand.Transaction = transaction; |
252 | try | ||
253 | { | ||
254 | StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); | ||
255 | } | ||
256 | catch (SqlException sqlEx) | ||
257 | { | ||
258 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); | ||
259 | throw; | ||
260 | } | ||
268 | } | 261 | } |
269 | catch (SqlException sqlEx) | 262 | |
263 | //Update primshapes | ||
264 | using (SqlCommand sqlCommand = conn.CreateCommand()) | ||
270 | { | 265 | { |
271 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); | 266 | sqlCommand.Transaction = transaction; |
272 | throw; | 267 | try |
268 | { | ||
269 | StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); | ||
270 | } | ||
271 | catch (SqlException sqlEx) | ||
272 | { | ||
273 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); | ||
274 | throw; | ||
275 | } | ||
273 | } | 276 | } |
274 | } | 277 | } |
278 | |||
279 | transaction.Commit(); | ||
275 | } | 280 | } |
276 | 281 | catch (Exception ex) | |
277 | transaction.Commit(); | ||
278 | } | ||
279 | catch (Exception ex) | ||
280 | { | ||
281 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message); | ||
282 | try | ||
283 | { | ||
284 | transaction.Rollback(); | ||
285 | } | ||
286 | catch (Exception ex2) | ||
287 | { | 282 | { |
288 | //Show error | 283 | _Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message); |
289 | _Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message); | 284 | try |
290 | 285 | { | |
286 | transaction.Rollback(); | ||
287 | } | ||
288 | catch (Exception ex2) | ||
289 | { | ||
290 | //Show error | ||
291 | _Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message); | ||
292 | |||
293 | } | ||
291 | } | 294 | } |
292 | } | 295 | } |
293 | } | 296 | } |
294 | |||
295 | } | 297 | } |
296 | 298 | ||
297 | /// <summary> | 299 | /// <summary> |