diff options
author | Machiavelli <none@none> | 2010-08-18 02:25:52 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2010-08-18 02:25:52 +0200 |
commit | 87218eadcdeac5ba86a035edfd079958405cb24f (patch) | |
tree | b72020ed0d390953b70d2026bf4c0b16c8271d11 /src/server/game/Accounts/AccountMgr.cpp | |
parent | 1ab2bd6d58adf35090ca3a9ef82eee00a14ff507 (diff) |
* HIGHLY EXPERIMENTAL - USE AT OWN RISK *
Database Layer:
- Implement connection pooling: Instead of 1 delay thread per database, you can configure between 1 and 32 worker threads that have a seperate thread in the core and have a seperate connection to the MySQL server (based on raczman/Albator´s database layer for Trinitycore3)
- Implement a configurable thread bundle for synchroneous requests from seperate core threads (see worldserver.conf.dist for more info)
- Every mapupdate thread now has its seperate MySQL connection to the world and characters database
- Drop inconsistent PExecuteLog function - query logging will be implemented CONSISTENTLY later
- Drop current prepared statement interface - this will be done *properly* later
- You´ll need to update your worldserver.conf and authserver.conf
- You´re recommended to make a backup of your databases before using this.
* HIGHLY EXPERIMENTAL - USE AT OWN RISK *
* HIGHLY EXPERIMENTAL - USE AT OWN RISK *
etc.
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Accounts/AccountMgr.cpp')
-rw-r--r-- | src/server/game/Accounts/AccountMgr.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 4c641fa9d87..8a53daa8278 100644 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -48,8 +48,7 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass return AOR_NAME_ALREDY_EXIST; // username does already exist } - if (!LoginDatabase.PExecute("INSERT INTO account(username,sha_pass_hash,joindate) VALUES('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str())) - return AOR_DB_INTERNAL_ERROR; // unexpected error + LoginDatabase.PExecute("INSERT INTO account(username,sha_pass_hash,joindate) VALUES('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str()); LoginDatabase.Execute("INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist,account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL"); return AOR_OK; // everything's fine @@ -89,16 +88,12 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid) LoginDatabase.BeginTransaction(); - bool res = - LoginDatabase.PExecute("DELETE FROM account WHERE id='%d'", accid) && - LoginDatabase.PExecute("DELETE FROM account_access WHERE id ='%d'", accid) && - LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid='%d'", accid); + LoginDatabase.PExecute("DELETE FROM account WHERE id='%d'", accid); + LoginDatabase.PExecute("DELETE FROM account_access WHERE id ='%d'", accid); + LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid='%d'", accid); LoginDatabase.CommitTransaction(); - if (!res) - return AOR_DB_INTERNAL_ERROR; // unexpected error; - return AOR_OK; } @@ -120,9 +115,8 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname, std::string safe_new_uname = new_uname; LoginDatabase.escape_string(safe_new_uname); - if (!LoginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%d'", safe_new_uname.c_str(), - CalculateShaPassHash(new_uname, new_passwd).c_str(), accid)) - return AOR_DB_INTERNAL_ERROR; // unexpected error + LoginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%d'", safe_new_uname.c_str(), + CalculateShaPassHash(new_uname, new_passwd).c_str(), accid); return AOR_OK; } @@ -141,9 +135,8 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd) normalizeString(new_passwd); // also reset s and v to force update at next realmd login - if (!LoginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%d'", - CalculateShaPassHash(username, new_passwd).c_str(), accid)) - return AOR_DB_INTERNAL_ERROR; // unexpected error + LoginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%d'", + CalculateShaPassHash(username, new_passwd).c_str(), accid); return AOR_OK; } |