diff options
Diffstat (limited to 'OpenSim/Framework/Data.MSSQL')
-rw-r--r-- | OpenSim/Framework/Data.MSSQL/MSSQLManager.cs | 96 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs | 95 |
2 files changed, 95 insertions, 96 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs index 26e8eb9..085cf57 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs | |||
@@ -439,101 +439,7 @@ namespace OpenSim.Framework.Data.MSSQL | |||
439 | 439 | ||
440 | return returnval; | 440 | return returnval; |
441 | } | 441 | } |
442 | 442 | ||
443 | |||
444 | /// <summary> | ||
445 | /// Creates a new user and inserts it into the database | ||
446 | /// </summary> | ||
447 | /// <param name="uuid">User ID</param> | ||
448 | /// <param name="username">First part of the login</param> | ||
449 | /// <param name="lastname">Second part of the login</param> | ||
450 | /// <param name="passwordHash">A salted hash of the users password</param> | ||
451 | /// <param name="passwordSalt">The salt used for the password hash</param> | ||
452 | /// <param name="homeRegion">A regionHandle of the users home region</param> | ||
453 | /// <param name="homeLocX">Home region position vector</param> | ||
454 | /// <param name="homeLocY">Home region position vector</param> | ||
455 | /// <param name="homeLocZ">Home region position vector</param> | ||
456 | /// <param name="homeLookAtX">Home region 'look at' vector</param> | ||
457 | /// <param name="homeLookAtY">Home region 'look at' vector</param> | ||
458 | /// <param name="homeLookAtZ">Home region 'look at' vector</param> | ||
459 | /// <param name="created">Account created (unix timestamp)</param> | ||
460 | /// <param name="lastlogin">Last login (unix timestamp)</param> | ||
461 | /// <param name="inventoryURI">Users inventory URI</param> | ||
462 | /// <param name="assetURI">Users asset URI</param> | ||
463 | /// <param name="canDoMask">I can do mask</param> | ||
464 | /// <param name="wantDoMask">I want to do mask</param> | ||
465 | /// <param name="aboutText">Profile text</param> | ||
466 | /// <param name="firstText">Firstlife text</param> | ||
467 | /// <param name="profileImage">UUID for profile image</param> | ||
468 | /// <param name="firstImage">UUID for firstlife image</param> | ||
469 | /// <returns>Success?</returns> | ||
470 | public bool insertUserRow(LLUUID uuid, string username, string lastname, string passwordHash, | ||
471 | string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, | ||
472 | float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, | ||
473 | string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, | ||
474 | string aboutText, string firstText, | ||
475 | LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey) | ||
476 | { | ||
477 | string sql = "INSERT INTO users "; | ||
478 | sql += "([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], "; | ||
479 | sql += | ||
480 | "[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], "; | ||
481 | sql += | ||
482 | "[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], "; | ||
483 | sql += "[profileFirstText], [profileImage], [profileFirstImage], [webLoginKey]) VALUES "; | ||
484 | |||
485 | sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, "; | ||
486 | sql += | ||
487 | "@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, "; | ||
488 | sql += | ||
489 | "@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, "; | ||
490 | sql += "@profileFirstText, @profileImage, @profileFirstImage, @webLoginKey);"; | ||
491 | |||
492 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
493 | parameters["UUID"] = uuid.ToString(); | ||
494 | parameters["username"] = username.ToString(); | ||
495 | parameters["lastname"] = lastname.ToString(); | ||
496 | parameters["passwordHash"] = passwordHash.ToString(); | ||
497 | parameters["passwordSalt"] = passwordSalt.ToString(); | ||
498 | parameters["homeRegion"] = homeRegion.ToString(); | ||
499 | parameters["homeLocationX"] = homeLocX.ToString(); | ||
500 | parameters["homeLocationY"] = homeLocY.ToString(); | ||
501 | parameters["homeLocationZ"] = homeLocZ.ToString(); | ||
502 | parameters["homeLookAtX"] = homeLookAtX.ToString(); | ||
503 | parameters["homeLookAtY"] = homeLookAtY.ToString(); | ||
504 | parameters["homeLookAtZ"] = homeLookAtZ.ToString(); | ||
505 | parameters["created"] = created.ToString(); | ||
506 | parameters["lastLogin"] = lastlogin.ToString(); | ||
507 | parameters["userInventoryURI"] = String.Empty; | ||
508 | parameters["userAssetURI"] = String.Empty; | ||
509 | parameters["profileCanDoMask"] = "0"; | ||
510 | parameters["profileWantDoMask"] = "0"; | ||
511 | parameters["profileAboutText"] = String.Empty; | ||
512 | parameters["profileFirstText"] = String.Empty; | ||
513 | parameters["profileImage"] = LLUUID.Zero.ToString(); | ||
514 | parameters["profileFirstImage"] = LLUUID.Zero.ToString(); | ||
515 | parameters["webLoginKey"] = LLUUID.Random().ToString(); | ||
516 | |||
517 | bool returnval = false; | ||
518 | |||
519 | try | ||
520 | { | ||
521 | IDbCommand result = Query(sql, parameters); | ||
522 | |||
523 | if (result.ExecuteNonQuery() == 1) | ||
524 | returnval = true; | ||
525 | |||
526 | result.Dispose(); | ||
527 | } | ||
528 | catch (Exception e) | ||
529 | { | ||
530 | m_log.Error(e.ToString()); | ||
531 | return false; | ||
532 | } | ||
533 | |||
534 | return returnval; | ||
535 | } | ||
536 | |||
537 | /// <summary> | 443 | /// <summary> |
538 | /// Execute a SQL statement stored in a resource, as a string | 444 | /// Execute a SQL statement stored in a resource, as a string |
539 | /// </summary> | 445 | /// </summary> |
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> |