aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs')
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs95
1 files changed, 94 insertions, 1 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
index 56ad3fa..d3a5835 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
@@ -505,7 +505,7 @@ namespace OpenSim.Framework.Data.MSSQL
505 { 505 {
506 lock (database) 506 lock (database)
507 { 507 {
508 database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, 508 InsertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt,
509 user.homeRegion, user.homeLocation.X, user.homeLocation.Y, 509 user.homeRegion, user.homeLocation.X, user.homeLocation.Y,
510 user.homeLocation.Z, 510 user.homeLocation.Z,
511 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, 511 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created,
@@ -523,6 +523,99 @@ namespace OpenSim.Framework.Data.MSSQL
523 } 523 }
524 524
525 /// <summary> 525 /// <summary>
526 /// Creates a new user and inserts it into the database
527 /// </summary>
528 /// <param name="uuid">User ID</param>
529 /// <param name="username">First part of the login</param>
530 /// <param name="lastname">Second part of the login</param>
531 /// <param name="passwordHash">A salted hash of the users password</param>
532 /// <param name="passwordSalt">The salt used for the password hash</param>
533 /// <param name="homeRegion">A regionHandle of the users home region</param>
534 /// <param name="homeLocX">Home region position vector</param>
535 /// <param name="homeLocY">Home region position vector</param>
536 /// <param name="homeLocZ">Home region position vector</param>
537 /// <param name="homeLookAtX">Home region 'look at' vector</param>
538 /// <param name="homeLookAtY">Home region 'look at' vector</param>
539 /// <param name="homeLookAtZ">Home region 'look at' vector</param>
540 /// <param name="created">Account created (unix timestamp)</param>
541 /// <param name="lastlogin">Last login (unix timestamp)</param>
542 /// <param name="inventoryURI">Users inventory URI</param>
543 /// <param name="assetURI">Users asset URI</param>
544 /// <param name="canDoMask">I can do mask</param>
545 /// <param name="wantDoMask">I want to do mask</param>
546 /// <param name="aboutText">Profile text</param>
547 /// <param name="firstText">Firstlife text</param>
548 /// <param name="profileImage">UUID for profile image</param>
549 /// <param name="firstImage">UUID for firstlife image</param>
550 /// <returns>Success?</returns>
551 private bool InsertUserRow(LLUUID uuid, string username, string lastname, string passwordHash,
552 string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
553 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
554 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
555 string aboutText, string firstText,
556 LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey)
557 {
558 string sql = "INSERT INTO "+m_usersTableName;
559 sql += " ([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], ";
560 sql +=
561 "[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], ";
562 sql +=
563 "[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], ";
564 sql += "[profileFirstText], [profileImage], [profileFirstImage], [webLoginKey]) VALUES ";
565
566 sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, ";
567 sql +=
568 "@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, ";
569 sql +=
570 "@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, ";
571 sql += "@profileFirstText, @profileImage, @profileFirstImage, @webLoginKey);";
572
573 Dictionary<string, string> parameters = new Dictionary<string, string>();
574 parameters["UUID"] = uuid.ToString();
575 parameters["username"] = username.ToString();
576 parameters["lastname"] = lastname.ToString();
577 parameters["passwordHash"] = passwordHash.ToString();
578 parameters["passwordSalt"] = passwordSalt.ToString();
579 parameters["homeRegion"] = homeRegion.ToString();
580 parameters["homeLocationX"] = homeLocX.ToString();
581 parameters["homeLocationY"] = homeLocY.ToString();
582 parameters["homeLocationZ"] = homeLocZ.ToString();
583 parameters["homeLookAtX"] = homeLookAtX.ToString();
584 parameters["homeLookAtY"] = homeLookAtY.ToString();
585 parameters["homeLookAtZ"] = homeLookAtZ.ToString();
586 parameters["created"] = created.ToString();
587 parameters["lastLogin"] = lastlogin.ToString();
588 parameters["userInventoryURI"] = String.Empty;
589 parameters["userAssetURI"] = String.Empty;
590 parameters["profileCanDoMask"] = "0";
591 parameters["profileWantDoMask"] = "0";
592 parameters["profileAboutText"] = String.Empty;
593 parameters["profileFirstText"] = String.Empty;
594 parameters["profileImage"] = LLUUID.Zero.ToString();
595 parameters["profileFirstImage"] = LLUUID.Zero.ToString();
596 parameters["webLoginKey"] = LLUUID.Random().ToString();
597
598 bool returnval = false;
599
600 try
601 {
602 IDbCommand result = database.Query(sql, parameters);
603
604 if (result.ExecuteNonQuery() == 1)
605 returnval = true;
606
607 result.Dispose();
608 }
609 catch (Exception e)
610 {
611 m_log.Error(e.ToString());
612 return false;
613 }
614
615 return returnval;
616 }
617
618 /// <summary>
526 /// Creates a new agent 619 /// Creates a new agent
527 /// </summary> 620 /// </summary>
528 /// <param name="agent">The agent to create</param> 621 /// <param name="agent">The agent to create</param>