aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLManager.cs85
1 files changed, 85 insertions, 0 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index a5434c8..affb8f3 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -536,6 +536,91 @@ namespace OpenSim.Framework.Data.MySQL
536 return returnval; 536 return returnval;
537 } 537 }
538 538
539 /// <summary>
540 /// Creates a new user and inserts it into the database
541 /// </summary>
542 /// <param name="uuid">User ID</param>
543 /// <param name="username">First part of the login</param>
544 /// <param name="lastname">Second part of the login</param>
545 /// <param name="passwordHash">A salted hash of the users password</param>
546 /// <param name="passwordSalt">The salt used for the password hash</param>
547 /// <param name="homeRegion">A regionHandle of the users home region</param>
548 /// <param name="homeLocX">Home region position vector</param>
549 /// <param name="homeLocY">Home region position vector</param>
550 /// <param name="homeLocZ">Home region position vector</param>
551 /// <param name="homeLookAtX">Home region 'look at' vector</param>
552 /// <param name="homeLookAtY">Home region 'look at' vector</param>
553 /// <param name="homeLookAtZ">Home region 'look at' vector</param>
554 /// <param name="created">Account created (unix timestamp)</param>
555 /// <param name="lastlogin">Last login (unix timestamp)</param>
556 /// <param name="inventoryURI">Users inventory URI</param>
557 /// <param name="assetURI">Users asset URI</param>
558 /// <param name="canDoMask">I can do mask</param>
559 /// <param name="wantDoMask">I want to do mask</param>
560 /// <param name="aboutText">Profile text</param>
561 /// <param name="firstText">Firstlife text</param>
562 /// <param name="profileImage">UUID for profile image</param>
563 /// <param name="firstImage">UUID for firstlife image</param>
564 /// <returns>Success?</returns>
565 public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
566 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText,
567 libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage)
568 {
569 string sql = "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, ";
570 sql += "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
571 sql += "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
572 sql += "`profileFirstText`, `profileImage`, `profileFirstImage`) VALUES ";
573
574 sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, ";
575 sql += "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
576 sql += "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
577 sql += "?profileFirstText, ?profileImage, ?profileFirstImage)";
578
579 Dictionary<string, string> parameters = new Dictionary<string, string>();
580 parameters["?UUID"] = uuid.ToStringHyphenated();
581 parameters["?username"] = username.ToString();
582 parameters["?lastname"] = lastname.ToString();
583 parameters["?passwordHash"] = passwordHash.ToString();
584 parameters["?passwordSalt"] = passwordSalt.ToString();
585 parameters["?homeRegion"] = homeRegion.ToString();
586 parameters["?homeLocationX"] = homeLocX.ToString();
587 parameters["?homeLocationY"] = homeLocY.ToString();
588 parameters["?homeLocationZ"] = homeLocZ.ToString();
589 parameters["?homeLookAtX"] = homeLookAtX.ToString();
590 parameters["?homeLookAtY"] = homeLookAtY.ToString();
591 parameters["?homeLookAtZ"] = homeLookAtZ.ToString();
592 parameters["?created"] = created.ToString();
593 parameters["?lastLogin"] = lastlogin.ToString();
594 parameters["?userInventoryURI"] = "";
595 parameters["?userAssetURI"] = "";
596 parameters["?profileCanDoMask"] = "0";
597 parameters["?profileWantDoMask"] = "0";
598 parameters["?profileAboutText"] = "";
599 parameters["?profileFirstText"] = "";
600 parameters["?profileImage"] = libsecondlife.LLUUID.Zero.ToStringHyphenated();
601 parameters["?profileFirstImage"] = libsecondlife.LLUUID.Zero.ToStringHyphenated();
602
603 bool returnval = false;
604
605 try
606 {
607 IDbCommand result = Query(sql, parameters);
608
609 if (result.ExecuteNonQuery() == 1)
610 returnval = true;
611
612 result.Dispose();
613 }
614 catch (Exception e)
615 {
616 Console.WriteLine(e.ToString());
617 return false;
618 }
619
620 return returnval;
621 }
622
623
539 /// <summary> 624 /// <summary>
540 /// Inserts a new region into the database 625 /// Inserts a new region into the database
541 /// </summary> 626 /// </summary>