aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGrid.Framework.Data.MySQL
diff options
context:
space:
mode:
authorAdam Frisby2007-06-24 14:36:08 +0000
committerAdam Frisby2007-06-24 14:36:08 +0000
commit2fde703ebd3fa687c139ccba956b0c81cdfb4090 (patch)
tree297ec428668b1b226efb6e4fa1a59a159acdf0d9 /OpenGridServices/OpenGrid.Framework.Data.MySQL
parent* Maintainence: Experimental console fix for Debian (diff)
downloadopensim-SC-2fde703ebd3fa687c139ccba956b0c81cdfb4090.zip
opensim-SC-2fde703ebd3fa687c139ccba956b0c81cdfb4090.tar.gz
opensim-SC-2fde703ebd3fa687c139ccba956b0c81cdfb4090.tar.bz2
opensim-SC-2fde703ebd3fa687c139ccba956b0c81cdfb4090.tar.xz
* "create user" command now works with the MySQL Data Storage Engine on the userserver.
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Data.MySQL')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs84
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs14
2 files changed, 98 insertions, 0 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
index 76d3faf..b42ec09 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
@@ -514,6 +514,90 @@ namespace OpenGrid.Framework.Data.MySQL
514 } 514 }
515 515
516 /// <summary> 516 /// <summary>
517 /// Creates a new user and inserts it into the database
518 /// </summary>
519 /// <param name="uuid">User ID</param>
520 /// <param name="username">First part of the login</param>
521 /// <param name="lastname">Second part of the login</param>
522 /// <param name="passwordHash">A salted hash of the users password</param>
523 /// <param name="passwordSalt">The salt used for the password hash</param>
524 /// <param name="homeRegion">A regionHandle of the users home region</param>
525 /// <param name="homeLocX">Home region position vector</param>
526 /// <param name="homeLocY">Home region position vector</param>
527 /// <param name="homeLocZ">Home region position vector</param>
528 /// <param name="homeLookAtX">Home region 'look at' vector</param>
529 /// <param name="homeLookAtY">Home region 'look at' vector</param>
530 /// <param name="homeLookAtZ">Home region 'look at' vector</param>
531 /// <param name="created">Account created (unix timestamp)</param>
532 /// <param name="lastlogin">Last login (unix timestamp)</param>
533 /// <param name="inventoryURI">Users inventory URI</param>
534 /// <param name="assetURI">Users asset URI</param>
535 /// <param name="canDoMask">I can do mask</param>
536 /// <param name="wantDoMask">I want to do mask</param>
537 /// <param name="aboutText">Profile text</param>
538 /// <param name="firstText">Firstlife text</param>
539 /// <param name="profileImage">UUID for profile image</param>
540 /// <param name="firstImage">UUID for firstlife image</param>
541 /// <returns>Success?</returns>
542 public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
543 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText,
544 libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage)
545 {
546 string sql = "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passworldSalt`, `homeRegion`, ";
547 sql += "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
548 sql += "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
549 sql += "`profileFirstText`, `profileImage`, profileFirstImage`) VALUES ";
550
551 sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passworldSalt, ?homeRegion, ";
552 sql += "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX`, ?homeLookAtY, ?homeLookAtZ, ?created, ";
553 sql += "?lastLogin`, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
554 sql += "?profileFirstText, ?profileImage, ?profileFirstImage)";
555
556 Dictionary<string, string> parameters = new Dictionary<string, string>();
557 parameters["?UUID"] = uuid.ToStringHyphenated();
558 parameters["?username"] = username.ToString();
559 parameters["?lastname"] = lastname.ToString();
560 parameters["?passwordHash"] = passwordHash.ToString();
561 parameters["?passworldSalt"] = passwordSalt.ToString();
562 parameters["?homeRegion"] = homeRegion.ToString();
563 parameters["?homeLocationX"] = homeLocX.ToString();
564 parameters["?homeLocationY"] = homeLocY.ToString();
565 parameters["?homeLocationZ"] = homeLocZ.ToString();
566 parameters["?homeLookAtX"] = homeLookAtX.ToString();
567 parameters["?homeLookAtY"] = homeLookAtY.ToString();
568 parameters["?homeLookAtZ"] = homeLookAtZ.ToString();
569 parameters["?created"] = created.ToString();
570 parameters["?lastLogin"] = lastlogin.ToString();
571 parameters["?userInventoryURI"] = inventoryURI.ToString();
572 parameters["?userAssetURI"] = assetURI.ToString();
573 parameters["?profileCanDoMask"] = canDoMask.ToString();
574 parameters["?profileWantDoMask"] = wantDoMask.ToString();
575 parameters["?profileAboutText"] = aboutText.ToString();
576 parameters["?profileFirstText"] = firstText.ToString();
577 parameters["?profileImage"] = profileImage.ToStringHyphenated();
578 parameters["?profileFirstImage"] = firstImage.ToStringHyphenated();
579
580 bool returnval = false;
581
582 try
583 {
584 IDbCommand result = Query(sql, parameters);
585
586 if (result.ExecuteNonQuery() == 1)
587 returnval = true;
588
589 result.Dispose();
590 }
591 catch (Exception e)
592 {
593 Console.WriteLine(e.ToString());
594 return false;
595 }
596
597 return returnval;
598 }
599
600 /// <summary>
517 /// Inserts a new region into the database 601 /// Inserts a new region into the database
518 /// </summary> 602 /// </summary>
519 /// <param name="profile">The region to insert</param> 603 /// <param name="profile">The region to insert</param>
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
index 032a0e6..e988c94 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
@@ -200,6 +200,20 @@ namespace OpenGrid.Framework.Data.MySQL
200 /// <param name="user">The user profile to create</param> 200 /// <param name="user">The user profile to create</param>
201 public void addNewUserProfile(UserProfileData user) 201 public void addNewUserProfile(UserProfileData user)
202 { 202 {
203 try
204 {
205 lock (database)
206 {
207 database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z,
208 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask,
209 user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage);
210 }
211 }
212 catch (Exception e)
213 {
214 database.Reconnect();
215 Console.WriteLine(e.ToString());
216 }
203 } 217 }
204 218
205 /// <summary> 219 /// <summary>