diff options
author | John Hurliman | 2009-11-02 11:19:55 -0800 |
---|---|---|
committer | John Hurliman | 2009-11-02 11:19:55 -0800 |
commit | 6309fcc5b4b42102b5bb901dbbdf44846f5643f2 (patch) | |
tree | 9f71f2801c6ed6eaa40fe637b0cda520a9e5894f /OpenSim/Data/MySQL/MySQLUserData.cs | |
parent | Fix an invalid argument exception in the remote admin module when. (diff) | |
download | opensim-SC-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.zip opensim-SC-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.tar.gz opensim-SC-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.tar.bz2 opensim-SC-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.tar.xz |
Reverting the memory leak patch for MySQL. Problems have been reported with the grid server after running for several hours
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserData.cs | 370 |
1 files changed, 184 insertions, 186 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index bd46dfc..04f872f 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs | |||
@@ -181,20 +181,21 @@ namespace OpenSim.Data.MySQL | |||
181 | param["?first"] = user; | 181 | param["?first"] = user; |
182 | param["?second"] = last; | 182 | param["?second"] = last; |
183 | 183 | ||
184 | using (IDbCommand result = dbm.Manager.Query( | 184 | IDbCommand result = |
185 | "SELECT * FROM " + m_usersTableName + " WHERE username = ?first AND lastname = ?second", param)) | 185 | dbm.Manager.Query( |
186 | { | 186 | "SELECT * FROM " + m_usersTableName + " WHERE username = ?first AND lastname = ?second", param); |
187 | using (IDataReader reader = result.ExecuteReader()) | 187 | IDataReader reader = result.ExecuteReader(); |
188 | { | 188 | |
189 | UserProfileData row = dbm.Manager.readUserRow(reader); | 189 | UserProfileData row = dbm.Manager.readUserRow(reader); |
190 | return row; | 190 | |
191 | } | 191 | reader.Dispose(); |
192 | } | 192 | result.Dispose(); |
193 | return row; | ||
193 | } | 194 | } |
194 | catch (Exception e) | 195 | catch (Exception e) |
195 | { | 196 | { |
196 | dbm.Manager.Reconnect(); | 197 | dbm.Manager.Reconnect(); |
197 | m_log.Error(e.Message, e); | 198 | m_log.Error(e.ToString()); |
198 | return null; | 199 | return null; |
199 | } | 200 | } |
200 | finally | 201 | finally |
@@ -219,30 +220,28 @@ namespace OpenSim.Data.MySQL | |||
219 | 220 | ||
220 | try | 221 | try |
221 | { | 222 | { |
222 | using (IDbCommand adder = dbm.Manager.Query( | 223 | IDbCommand adder = |
223 | "INSERT INTO `" + m_userFriendsTableName + "` " + | 224 | dbm.Manager.Query( |
224 | "(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " + | 225 | "INSERT INTO `" + m_userFriendsTableName + "` " + |
225 | "VALUES " + | 226 | "(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " + |
226 | "(?ownerID,?friendID,?friendPerms,?datetimestamp)", | 227 | "VALUES " + |
227 | param)) | 228 | "(?ownerID,?friendID,?friendPerms,?datetimestamp)", |
228 | { | 229 | param); |
229 | adder.ExecuteNonQuery(); | 230 | adder.ExecuteNonQuery(); |
230 | } | 231 | |
231 | 232 | adder = | |
232 | using (IDbCommand adder = dbm.Manager.Query( | 233 | dbm.Manager.Query( |
233 | "INSERT INTO `" + m_userFriendsTableName + "` " + | 234 | "INSERT INTO `" + m_userFriendsTableName + "` " + |
234 | "(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " + | 235 | "(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " + |
235 | "VALUES " + | 236 | "VALUES " + |
236 | "(?friendID,?ownerID,?friendPerms,?datetimestamp)", | 237 | "(?friendID,?ownerID,?friendPerms,?datetimestamp)", |
237 | param)) | 238 | param); |
238 | { | 239 | adder.ExecuteNonQuery(); |
239 | adder.ExecuteNonQuery(); | ||
240 | } | ||
241 | } | 240 | } |
242 | catch (Exception e) | 241 | catch (Exception e) |
243 | { | 242 | { |
244 | dbm.Manager.Reconnect(); | 243 | dbm.Manager.Reconnect(); |
245 | m_log.Error(e.Message, e); | 244 | m_log.Error(e.ToString()); |
246 | return; | 245 | return; |
247 | } | 246 | } |
248 | finally | 247 | finally |
@@ -261,24 +260,22 @@ namespace OpenSim.Data.MySQL | |||
261 | 260 | ||
262 | try | 261 | try |
263 | { | 262 | { |
264 | using (IDbCommand updater = dbm.Manager.Query( | 263 | IDbCommand updater = |
264 | dbm.Manager.Query( | ||
265 | "delete from " + m_userFriendsTableName + " where ownerID = ?ownerID and friendID = ?friendID", | 265 | "delete from " + m_userFriendsTableName + " where ownerID = ?ownerID and friendID = ?friendID", |
266 | param)) | 266 | param); |
267 | { | 267 | updater.ExecuteNonQuery(); |
268 | updater.ExecuteNonQuery(); | ||
269 | } | ||
270 | 268 | ||
271 | using (IDbCommand updater = dbm.Manager.Query( | 269 | updater = |
270 | dbm.Manager.Query( | ||
272 | "delete from " + m_userFriendsTableName + " where ownerID = ?friendID and friendID = ?ownerID", | 271 | "delete from " + m_userFriendsTableName + " where ownerID = ?friendID and friendID = ?ownerID", |
273 | param)) | 272 | param); |
274 | { | 273 | updater.ExecuteNonQuery(); |
275 | updater.ExecuteNonQuery(); | ||
276 | } | ||
277 | } | 274 | } |
278 | catch (Exception e) | 275 | catch (Exception e) |
279 | { | 276 | { |
280 | dbm.Manager.Reconnect(); | 277 | dbm.Manager.Reconnect(); |
281 | m_log.Error(e.Message, e); | 278 | m_log.Error(e.ToString()); |
282 | return; | 279 | return; |
283 | } | 280 | } |
284 | finally | 281 | finally |
@@ -298,19 +295,18 @@ namespace OpenSim.Data.MySQL | |||
298 | 295 | ||
299 | try | 296 | try |
300 | { | 297 | { |
301 | using (IDbCommand updater = dbm.Manager.Query( | 298 | IDbCommand updater = |
299 | dbm.Manager.Query( | ||
302 | "update " + m_userFriendsTableName + | 300 | "update " + m_userFriendsTableName + |
303 | " SET friendPerms = ?friendPerms " + | 301 | " SET friendPerms = ?friendPerms " + |
304 | "where ownerID = ?ownerID and friendID = ?friendID", | 302 | "where ownerID = ?ownerID and friendID = ?friendID", |
305 | param)) | 303 | param); |
306 | { | 304 | updater.ExecuteNonQuery(); |
307 | updater.ExecuteNonQuery(); | ||
308 | } | ||
309 | } | 305 | } |
310 | catch (Exception e) | 306 | catch (Exception e) |
311 | { | 307 | { |
312 | dbm.Manager.Reconnect(); | 308 | dbm.Manager.Reconnect(); |
313 | m_log.Error(e.Message, e); | 309 | m_log.Error(e.ToString()); |
314 | return; | 310 | return; |
315 | } | 311 | } |
316 | finally | 312 | finally |
@@ -331,33 +327,34 @@ namespace OpenSim.Data.MySQL | |||
331 | try | 327 | try |
332 | { | 328 | { |
333 | //Left Join userfriends to itself | 329 | //Left Join userfriends to itself |
334 | using (IDbCommand result = dbm.Manager.Query( | 330 | IDbCommand result = |
335 | "select a.ownerID,a.friendID,a.friendPerms,b.friendPerms as ownerperms from " + | 331 | dbm.Manager.Query( |
336 | m_userFriendsTableName + " as a, " + m_userFriendsTableName + " as b" + | 332 | "select a.ownerID,a.friendID,a.friendPerms,b.friendPerms as ownerperms from " + |
337 | " where a.ownerID = ?ownerID and b.ownerID = a.friendID and b.friendID = a.ownerID", | 333 | m_userFriendsTableName + " as a, " + m_userFriendsTableName + " as b" + |
338 | param)) | 334 | " where a.ownerID = ?ownerID and b.ownerID = a.friendID and b.friendID = a.ownerID", |
335 | param); | ||
336 | IDataReader reader = result.ExecuteReader(); | ||
337 | |||
338 | while (reader.Read()) | ||
339 | { | 339 | { |
340 | using (IDataReader reader = result.ExecuteReader()) | 340 | FriendListItem fli = new FriendListItem(); |
341 | { | 341 | fli.FriendListOwner = new UUID((string) reader["ownerID"]); |
342 | while (reader.Read()) | 342 | fli.Friend = new UUID((string) reader["friendID"]); |
343 | { | 343 | fli.FriendPerms = (uint) Convert.ToInt32(reader["friendPerms"]); |
344 | FriendListItem fli = new FriendListItem(); | 344 | |
345 | fli.FriendListOwner = new UUID((string)reader["ownerID"]); | 345 | // This is not a real column in the database table, it's a joined column from the opposite record |
346 | fli.Friend = new UUID((string)reader["friendID"]); | 346 | fli.FriendListOwnerPerms = (uint) Convert.ToInt32(reader["ownerperms"]); |
347 | fli.FriendPerms = (uint)Convert.ToInt32(reader["friendPerms"]); | 347 | |
348 | 348 | Lfli.Add(fli); | |
349 | // This is not a real column in the database table, it's a joined column from the opposite record | ||
350 | fli.FriendListOwnerPerms = (uint)Convert.ToInt32(reader["ownerperms"]); | ||
351 | |||
352 | Lfli.Add(fli); | ||
353 | } | ||
354 | } | ||
355 | } | 349 | } |
350 | |||
351 | reader.Dispose(); | ||
352 | result.Dispose(); | ||
356 | } | 353 | } |
357 | catch (Exception e) | 354 | catch (Exception e) |
358 | { | 355 | { |
359 | dbm.Manager.Reconnect(); | 356 | dbm.Manager.Reconnect(); |
360 | m_log.Error(e.Message, e); | 357 | m_log.Error(e.ToString()); |
361 | return Lfli; | 358 | return Lfli; |
362 | } | 359 | } |
363 | finally | 360 | finally |
@@ -379,29 +376,29 @@ namespace OpenSim.Data.MySQL | |||
379 | { | 376 | { |
380 | Dictionary<string, object> param = new Dictionary<string, object>(); | 377 | Dictionary<string, object> param = new Dictionary<string, object>(); |
381 | param["?uuid"] = uuid.ToString(); | 378 | param["?uuid"] = uuid.ToString(); |
379 | IDbCommand result = | ||
380 | dbm.Manager.Query("select agentOnline,currentHandle from " + m_agentsTableName + | ||
381 | " where UUID = ?uuid", param); | ||
382 | 382 | ||
383 | using (IDbCommand result = dbm.Manager.Query("select agentOnline,currentHandle from " + m_agentsTableName + | 383 | IDataReader reader = result.ExecuteReader(); |
384 | " where UUID = ?uuid", param)) | 384 | while (reader.Read()) |
385 | { | 385 | { |
386 | using (IDataReader reader = result.ExecuteReader()) | 386 | FriendRegionInfo fri = new FriendRegionInfo(); |
387 | { | 387 | fri.isOnline = (sbyte)reader["agentOnline"] != 0; |
388 | while (reader.Read()) | 388 | fri.regionHandle = (ulong)reader["currentHandle"]; |
389 | { | 389 | |
390 | FriendRegionInfo fri = new FriendRegionInfo(); | 390 | infos[uuid] = fri; |
391 | fri.isOnline = (sbyte)reader["agentOnline"] != 0; | ||
392 | fri.regionHandle = (ulong)reader["currentHandle"]; | ||
393 | |||
394 | infos[uuid] = fri; | ||
395 | } | ||
396 | } | ||
397 | } | 391 | } |
392 | |||
393 | reader.Dispose(); | ||
394 | result.Dispose(); | ||
398 | } | 395 | } |
399 | } | 396 | } |
400 | catch (Exception e) | 397 | catch (Exception e) |
401 | { | 398 | { |
402 | m_log.Warn("[MYSQL]: Got exception on trying to find friends regions:", e); | 399 | m_log.Warn("[MYSQL]: Got exception on trying to find friends regions:", e); |
403 | dbm.Manager.Reconnect(); | 400 | dbm.Manager.Reconnect(); |
404 | m_log.Error(e.Message, e); | 401 | m_log.Error(e.ToString()); |
405 | } | 402 | } |
406 | finally | 403 | finally |
407 | { | 404 | { |
@@ -430,28 +427,28 @@ namespace OpenSim.Data.MySQL | |||
430 | 427 | ||
431 | try | 428 | try |
432 | { | 429 | { |
433 | using (IDbCommand result = dbm.Manager.Query( | 430 | IDbCommand result = |
434 | "SELECT UUID,username,lastname FROM " + m_usersTableName + | 431 | dbm.Manager.Query( |
435 | " WHERE username like ?first AND lastname like ?second LIMIT 100", | 432 | "SELECT UUID,username,lastname FROM " + m_usersTableName + |
436 | param)) | 433 | " WHERE username like ?first AND lastname like ?second LIMIT 100", |
434 | param); | ||
435 | IDataReader reader = result.ExecuteReader(); | ||
436 | |||
437 | while (reader.Read()) | ||
437 | { | 438 | { |
438 | using (IDataReader reader = result.ExecuteReader()) | 439 | AvatarPickerAvatar user = new AvatarPickerAvatar(); |
439 | { | 440 | user.AvatarID = new UUID((string) reader["UUID"]); |
440 | while (reader.Read()) | 441 | user.firstName = (string) reader["username"]; |
441 | { | 442 | user.lastName = (string) reader["lastname"]; |
442 | AvatarPickerAvatar user = new AvatarPickerAvatar(); | 443 | returnlist.Add(user); |
443 | user.AvatarID = new UUID((string)reader["UUID"]); | ||
444 | user.firstName = (string)reader["username"]; | ||
445 | user.lastName = (string)reader["lastname"]; | ||
446 | returnlist.Add(user); | ||
447 | } | ||
448 | } | ||
449 | } | 444 | } |
445 | reader.Dispose(); | ||
446 | result.Dispose(); | ||
450 | } | 447 | } |
451 | catch (Exception e) | 448 | catch (Exception e) |
452 | { | 449 | { |
453 | dbm.Manager.Reconnect(); | 450 | dbm.Manager.Reconnect(); |
454 | m_log.Error(e.Message, e); | 451 | m_log.Error(e.ToString()); |
455 | return returnlist; | 452 | return returnlist; |
456 | } | 453 | } |
457 | finally | 454 | finally |
@@ -468,28 +465,28 @@ namespace OpenSim.Data.MySQL | |||
468 | Dictionary<string, object> param = new Dictionary<string, object>(); | 465 | Dictionary<string, object> param = new Dictionary<string, object>(); |
469 | param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%"; | 466 | param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%"; |
470 | 467 | ||
471 | using (IDbCommand result = dbm.Manager.Query( | 468 | IDbCommand result = |
472 | "SELECT UUID,username,lastname FROM " + m_usersTableName + | 469 | dbm.Manager.Query( |
473 | " WHERE username like ?first OR lastname like ?first LIMIT 100", | 470 | "SELECT UUID,username,lastname FROM " + m_usersTableName + |
474 | param)) | 471 | " WHERE username like ?first OR lastname like ?first LIMIT 100", |
472 | param); | ||
473 | IDataReader reader = result.ExecuteReader(); | ||
474 | |||
475 | while (reader.Read()) | ||
475 | { | 476 | { |
476 | using (IDataReader reader = result.ExecuteReader()) | 477 | AvatarPickerAvatar user = new AvatarPickerAvatar(); |
477 | { | 478 | user.AvatarID = new UUID((string) reader["UUID"]); |
478 | while (reader.Read()) | 479 | user.firstName = (string) reader["username"]; |
479 | { | 480 | user.lastName = (string) reader["lastname"]; |
480 | AvatarPickerAvatar user = new AvatarPickerAvatar(); | 481 | returnlist.Add(user); |
481 | user.AvatarID = new UUID((string)reader["UUID"]); | ||
482 | user.firstName = (string)reader["username"]; | ||
483 | user.lastName = (string)reader["lastname"]; | ||
484 | returnlist.Add(user); | ||
485 | } | ||
486 | } | ||
487 | } | 482 | } |
483 | reader.Dispose(); | ||
484 | result.Dispose(); | ||
488 | } | 485 | } |
489 | catch (Exception e) | 486 | catch (Exception e) |
490 | { | 487 | { |
491 | dbm.Manager.Reconnect(); | 488 | dbm.Manager.Reconnect(); |
492 | m_log.Error(e.Message, e); | 489 | m_log.Error(e.ToString()); |
493 | return returnlist; | 490 | return returnlist; |
494 | } | 491 | } |
495 | finally | 492 | finally |
@@ -513,19 +510,20 @@ namespace OpenSim.Data.MySQL | |||
513 | Dictionary<string, object> param = new Dictionary<string, object>(); | 510 | Dictionary<string, object> param = new Dictionary<string, object>(); |
514 | param["?uuid"] = uuid.ToString(); | 511 | param["?uuid"] = uuid.ToString(); |
515 | 512 | ||
516 | using (IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_usersTableName + " WHERE UUID = ?uuid", param)) | 513 | IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_usersTableName + " WHERE UUID = ?uuid", param); |
517 | { | 514 | IDataReader reader = result.ExecuteReader(); |
518 | using (IDataReader reader = result.ExecuteReader()) | 515 | |
519 | { | 516 | UserProfileData row = dbm.Manager.readUserRow(reader); |
520 | UserProfileData row = dbm.Manager.readUserRow(reader); | 517 | |
521 | return row; | 518 | reader.Dispose(); |
522 | } | 519 | result.Dispose(); |
523 | } | 520 | |
521 | return row; | ||
524 | } | 522 | } |
525 | catch (Exception e) | 523 | catch (Exception e) |
526 | { | 524 | { |
527 | dbm.Manager.Reconnect(); | 525 | dbm.Manager.Reconnect(); |
528 | m_log.Error(e.Message, e); | 526 | m_log.Error(e.ToString()); |
529 | return null; | 527 | return null; |
530 | } | 528 | } |
531 | finally | 529 | finally |
@@ -571,15 +569,15 @@ namespace OpenSim.Data.MySQL | |||
571 | 569 | ||
572 | try | 570 | try |
573 | { | 571 | { |
574 | dbm.Manager.ExecuteParameterizedSql( | 572 | dbm.Manager.ExecuteParameterizedSql( |
575 | "update " + m_usersTableName + " SET webLoginKey = ?webLoginKey " + | 573 | "update " + m_usersTableName + " SET webLoginKey = ?webLoginKey " + |
576 | "where UUID = ?UUID", | 574 | "where UUID = ?UUID", |
577 | param); | 575 | param); |
578 | } | 576 | } |
579 | catch (Exception e) | 577 | catch (Exception e) |
580 | { | 578 | { |
581 | dbm.Manager.Reconnect(); | 579 | dbm.Manager.Reconnect(); |
582 | m_log.Error(e.Message, e); | 580 | m_log.Error(e.ToString()); |
583 | return; | 581 | return; |
584 | } | 582 | } |
585 | finally | 583 | finally |
@@ -602,19 +600,21 @@ namespace OpenSim.Data.MySQL | |||
602 | Dictionary<string, object> param = new Dictionary<string, object>(); | 600 | Dictionary<string, object> param = new Dictionary<string, object>(); |
603 | param["?uuid"] = uuid.ToString(); | 601 | param["?uuid"] = uuid.ToString(); |
604 | 602 | ||
605 | using (IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_agentsTableName + " WHERE UUID = ?uuid", param)) | 603 | IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_agentsTableName + " WHERE UUID = ?uuid", |
606 | { | 604 | param); |
607 | using (IDataReader reader = result.ExecuteReader()) | 605 | IDataReader reader = result.ExecuteReader(); |
608 | { | 606 | |
609 | UserAgentData row = dbm.Manager.readAgentRow(reader); | 607 | UserAgentData row = dbm.Manager.readAgentRow(reader); |
610 | return row; | 608 | |
611 | } | 609 | reader.Dispose(); |
612 | } | 610 | result.Dispose(); |
611 | |||
612 | return row; | ||
613 | } | 613 | } |
614 | catch (Exception e) | 614 | catch (Exception e) |
615 | { | 615 | { |
616 | dbm.Manager.Reconnect(); | 616 | dbm.Manager.Reconnect(); |
617 | m_log.Error(e.Message, e); | 617 | m_log.Error(e.ToString()); |
618 | return null; | 618 | return null; |
619 | } | 619 | } |
620 | finally | 620 | finally |
@@ -638,20 +638,19 @@ namespace OpenSim.Data.MySQL | |||
638 | 638 | ||
639 | try | 639 | try |
640 | { | 640 | { |
641 | dbm.Manager.insertUserRow( | 641 | dbm.Manager.insertUserRow(user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt, |
642 | user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt, | 642 | user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, |
643 | user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, | 643 | user.HomeLocation.Z, |
644 | user.HomeLocation.Z, | 644 | user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, |
645 | user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, | 645 | user.LastLogin, user.UserInventoryURI, user.UserAssetURI, |
646 | user.LastLogin, user.UserInventoryURI, user.UserAssetURI, | 646 | user.CanDoMask, user.WantDoMask, |
647 | user.CanDoMask, user.WantDoMask, | 647 | user.AboutText, user.FirstLifeAboutText, user.Image, |
648 | user.AboutText, user.FirstLifeAboutText, user.Image, | 648 | user.FirstLifeImage, user.WebLoginKey, user.UserFlags, user.GodLevel, user.CustomType, user.Partner); |
649 | user.FirstLifeImage, user.WebLoginKey, user.UserFlags, user.GodLevel, user.CustomType, user.Partner); | ||
650 | } | 649 | } |
651 | catch (Exception e) | 650 | catch (Exception e) |
652 | { | 651 | { |
653 | dbm.Manager.Reconnect(); | 652 | dbm.Manager.Reconnect(); |
654 | m_log.Error(e.Message, e); | 653 | m_log.Error(e.ToString()); |
655 | } | 654 | } |
656 | finally | 655 | finally |
657 | { | 656 | { |
@@ -677,7 +676,7 @@ namespace OpenSim.Data.MySQL | |||
677 | catch (Exception e) | 676 | catch (Exception e) |
678 | { | 677 | { |
679 | dbm.Manager.Reconnect(); | 678 | dbm.Manager.Reconnect(); |
680 | m_log.Error(e.Message, e); | 679 | m_log.Error(e.ToString()); |
681 | } | 680 | } |
682 | finally | 681 | finally |
683 | { | 682 | { |
@@ -694,15 +693,14 @@ namespace OpenSim.Data.MySQL | |||
694 | MySQLSuperManager dbm = GetLockedConnection("UpdateUserProfile"); | 693 | MySQLSuperManager dbm = GetLockedConnection("UpdateUserProfile"); |
695 | try | 694 | try |
696 | { | 695 | { |
697 | dbm.Manager.updateUserRow( | 696 | dbm.Manager.updateUserRow(user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt, |
698 | user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt, | 697 | user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, |
699 | user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, | 698 | user.HomeLocation.Z, user.HomeLookAt.X, |
700 | user.HomeLocation.Z, user.HomeLookAt.X, | 699 | user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin, |
701 | user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin, | 700 | user.UserInventoryURI, |
702 | user.UserInventoryURI, | 701 | user.UserAssetURI, user.CanDoMask, user.WantDoMask, user.AboutText, |
703 | user.UserAssetURI, user.CanDoMask, user.WantDoMask, user.AboutText, | 702 | user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey, |
704 | user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey, | 703 | user.UserFlags, user.GodLevel, user.CustomType, user.Partner); |
705 | user.UserFlags, user.GodLevel, user.CustomType, user.Partner); | ||
706 | } | 704 | } |
707 | finally | 705 | finally |
708 | { | 706 | { |
@@ -750,29 +748,29 @@ namespace OpenSim.Data.MySQL | |||
750 | Dictionary<string, object> param = new Dictionary<string, object>(); | 748 | Dictionary<string, object> param = new Dictionary<string, object>(); |
751 | param["?owner"] = user.ToString(); | 749 | param["?owner"] = user.ToString(); |
752 | 750 | ||
753 | using (IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_appearanceTableName + " WHERE owner = ?owner", param)) | 751 | IDbCommand result = dbm.Manager.Query( |
752 | "SELECT * FROM " + m_appearanceTableName + " WHERE owner = ?owner", param); | ||
753 | IDataReader reader = result.ExecuteReader(); | ||
754 | |||
755 | AvatarAppearance appearance = dbm.Manager.readAppearanceRow(reader); | ||
756 | |||
757 | reader.Dispose(); | ||
758 | result.Dispose(); | ||
759 | |||
760 | if (null == appearance) | ||
754 | { | 761 | { |
755 | using (IDataReader reader = result.ExecuteReader()) | 762 | m_log.WarnFormat("[USER DB] No appearance found for user {0}", user.ToString()); |
756 | { | 763 | return null; |
757 | AvatarAppearance appearance = dbm.Manager.readAppearanceRow(reader); | ||
758 | |||
759 | if (appearance == null) | ||
760 | { | ||
761 | m_log.WarnFormat("[USER DB] No appearance found for user {0}", user.ToString()); | ||
762 | return null; | ||
763 | } | ||
764 | else | ||
765 | { | ||
766 | appearance.SetAttachments(GetUserAttachments(user)); | ||
767 | return appearance; | ||
768 | } | ||
769 | } | ||
770 | } | 764 | } |
765 | |||
766 | appearance.SetAttachments(GetUserAttachments(user)); | ||
767 | |||
768 | return appearance; | ||
771 | } | 769 | } |
772 | catch (Exception e) | 770 | catch (Exception e) |
773 | { | 771 | { |
774 | dbm.Manager.Reconnect(); | 772 | dbm.Manager.Reconnect(); |
775 | m_log.Error(e.Message, e); | 773 | m_log.Error(e.ToString()); |
776 | return null; | 774 | return null; |
777 | } | 775 | } |
778 | finally | 776 | finally |
@@ -800,7 +798,7 @@ namespace OpenSim.Data.MySQL | |||
800 | catch (Exception e) | 798 | catch (Exception e) |
801 | { | 799 | { |
802 | dbm.Manager.Reconnect(); | 800 | dbm.Manager.Reconnect(); |
803 | m_log.Error(e.Message, e); | 801 | m_log.Error(e.ToString()); |
804 | } | 802 | } |
805 | finally | 803 | finally |
806 | { | 804 | { |
@@ -835,20 +833,20 @@ namespace OpenSim.Data.MySQL | |||
835 | 833 | ||
836 | try | 834 | try |
837 | { | 835 | { |
838 | using (IDbCommand result = dbm.Manager.Query( | 836 | IDbCommand result = dbm.Manager.Query( |
839 | "SELECT attachpoint, item, asset from " + m_attachmentsTableName + " WHERE UUID = ?uuid", param)) | 837 | "SELECT attachpoint, item, asset from " + m_attachmentsTableName + " WHERE UUID = ?uuid", param); |
840 | { | 838 | IDataReader reader = result.ExecuteReader(); |
841 | using (IDataReader reader = result.ExecuteReader()) | 839 | |
842 | { | 840 | Hashtable ret = dbm.Manager.readAttachments(reader); |
843 | Hashtable ret = dbm.Manager.readAttachments(reader); | 841 | |
844 | return ret; | 842 | reader.Dispose(); |
845 | } | 843 | result.Dispose(); |
846 | } | 844 | return ret; |
847 | } | 845 | } |
848 | catch (Exception e) | 846 | catch (Exception e) |
849 | { | 847 | { |
850 | dbm.Manager.Reconnect(); | 848 | dbm.Manager.Reconnect(); |
851 | m_log.Error(e.Message, e); | 849 | m_log.Error(e.ToString()); |
852 | return null; | 850 | return null; |
853 | } | 851 | } |
854 | finally | 852 | finally |
@@ -907,7 +905,7 @@ namespace OpenSim.Data.MySQL | |||
907 | catch (Exception e) | 905 | catch (Exception e) |
908 | { | 906 | { |
909 | dbm.Manager.Reconnect(); | 907 | dbm.Manager.Reconnect(); |
910 | m_log.Error(e.Message, e); | 908 | m_log.Error(e.ToString()); |
911 | return; | 909 | return; |
912 | } | 910 | } |
913 | finally | 911 | finally |