* 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
This commit is contained in:
Machiavelli
2010-08-18 02:25:52 +02:00
parent 1ab2bd6d58
commit 87218eadcd
39 changed files with 1568 additions and 731 deletions
+8 -15
View File
@@ -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;
}