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