aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Database
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-05-13 23:33:02 +0200
committerShauren <shauren.trinity@gmail.com>2014-05-13 23:33:02 +0200
commit81b8deef529517a1f13397ff2aa13154bccf86c9 (patch)
tree050f4546bfcbef1eeb119dca13d1e668d9f6fcfc /src/server/shared/Database
parent8ec0be28027f3eda55995ef13e6e522631e36dc1 (diff)
Core/Battle.net: Use prepared statements in Battlenet::AccountMgr
Diffstat (limited to 'src/server/shared/Database')
-rw-r--r--src/server/shared/Database/Implementation/LoginDatabase.cpp5
-rw-r--r--src/server/shared/Database/Implementation/LoginDatabase.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp
index 3ff0f923af8..208873448c6 100644
--- a/src/server/shared/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp
@@ -110,4 +110,9 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_SEL_BNET_GAME_ACCOUNT, "SELECT a.id, ab.bandate, ab.unbandate, ab.active FROM account a LEFT JOIN account_banned ab ON a.id = ab.id WHERE username = ? AND battlenet_account = ?", CONNECTION_SYNCH);
PrepareStatement(LOGIN_UPD_BNET_LAST_LOGIN_INFO, "UPDATE battlenet_accounts SET last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_BNET_CHARACTER_COUNTS, "SELECT rc.numchars, r.id, r.Region, r.Battlegroup, r.gamebuild FROM realmcharacters rc INNER JOIN realmlist r ON rc.realmid = r.id WHERE rc.acctid = ?", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_INS_BNET_ACCOUNT, "INSERT INTO battlenet_accounts (`email`,`sha_pass_hash`) VALUES (?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_SEL_BNET_ACCOUNT_EMAIL_BY_ID, "SELECT email FROM battlenet_accounts WHERE id = ?", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_SEL_BNET_ACCOUNT_ID_BY_EMAIL, "SELECT id FROM battlenet_accounts WHERE email = ?", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_UPD_BNET_PASSWORD, "UPDATE account SET v = '', s = '', username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_SEL_BNET_CHECK_PASSWORD, "SELECT 1 FROM battlenet_accounts WHERE id = %u AND sha_pass_hash = ?", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h
index 2f1edab270b..18f9110409d 100644
--- a/src/server/shared/Database/Implementation/LoginDatabase.h
+++ b/src/server/shared/Database/Implementation/LoginDatabase.h
@@ -129,6 +129,11 @@ enum LoginDatabaseStatements
LOGIN_SEL_BNET_GAME_ACCOUNT,
LOGIN_UPD_BNET_LAST_LOGIN_INFO,
LOGIN_SEL_BNET_CHARACTER_COUNTS,
+ LOGIN_INS_BNET_ACCOUNT,
+ LOGIN_SEL_BNET_ACCOUNT_EMAIL_BY_ID,
+ LOGIN_SEL_BNET_ACCOUNT_ID_BY_EMAIL,
+ LOGIN_UPD_BNET_PASSWORD,
+ LOGIN_SEL_BNET_CHECK_PASSWORD,
MAX_LOGINDATABASE_STATEMENTS
};