AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
LoginDatabaseConnection Class Reference

#include "LoginDatabase.h"

Inheritance diagram for LoginDatabaseConnection:
MySQLConnection

Public Types

typedef LoginDatabaseStatements Statements
 

Public Member Functions

 LoginDatabaseConnection (MySQLConnectionInfo &connInfo)
 
 LoginDatabaseConnection (ProducerConsumerQueue< SQLOperation * > *q, MySQLConnectionInfo &connInfo)
 
 ~LoginDatabaseConnection () override
 
void DoPrepareStatements () override
 
- Public Member Functions inherited from MySQLConnection
 MySQLConnection (MySQLConnectionInfo &connInfo)
 
 MySQLConnection (ProducerConsumerQueue< SQLOperation * > *queue, MySQLConnectionInfo &connInfo)
 Constructor for synchronous connections. More...
 
virtual ~MySQLConnection ()
 Constructor for asynchronous connections. More...
 
virtual uint32 Open ()
 
void Close ()
 
bool PrepareStatements ()
 
bool Execute (std::string_view sql)
 
bool Execute (PreparedStatementBase *stmt)
 
ResultSetQuery (std::string_view sql)
 
PreparedResultSetQuery (PreparedStatementBase *stmt)
 
bool _Query (std::string_view sql, MySQLResult **pResult, MySQLField **pFields, uint64 *pRowCount, uint32 *pFieldCount)
 
bool _Query (PreparedStatementBase *stmt, MySQLPreparedStatement **mysqlStmt, MySQLResult **pResult, uint64 *pRowCount, uint32 *pFieldCount)
 
void BeginTransaction ()
 
void RollbackTransaction ()
 
void CommitTransaction ()
 
int ExecuteTransaction (std::shared_ptr< TransactionBase > transaction)
 
std::size_t EscapeString (char *to, const char *from, std::size_t length)
 
void Ping ()
 
uint32 GetLastError ()
 

Additional Inherited Members

- Protected Types inherited from MySQLConnection
typedef std::vector< std::unique_ptr< MySQLPreparedStatement > > PreparedStatementContainer
 
- Protected Member Functions inherited from MySQLConnection
bool LockIfReady ()
 
void Unlock ()
 Called by parent databasepool. Will let other threads access this connection. More...
 
uint32 GetServerVersion () const
 
std::string GetServerInfo () const
 
MySQLPreparedStatementGetPreparedStatement (uint32 index)
 
void PrepareStatement (uint32 index, std::string_view sql, ConnectionFlags flags)
 
virtual void DoPrepareStatements ()=0
 
virtual bool _HandleMySQLErrno (uint32 errNo, char const *err="", uint8 attempts=5)
 
- Protected Attributes inherited from MySQLConnection
PreparedStatementContainer m_stmts
 
bool m_reconnecting
 PreparedStatements storage. More...
 
bool m_prepareError
 Are we reconnecting? More...
 
MySQLHandlem_Mysql
 Was there any error while preparing statements? More...
 

Detailed Description

Member Typedef Documentation

◆ Statements

Constructor & Destructor Documentation

◆ LoginDatabaseConnection() [1/2]

LoginDatabaseConnection::LoginDatabaseConnection ( MySQLConnectionInfo connInfo)
148 : MySQLConnection(connInfo)
149{
150}
Definition: MySQLConnection.h:55

◆ LoginDatabaseConnection() [2/2]

LoginDatabaseConnection::LoginDatabaseConnection ( ProducerConsumerQueue< SQLOperation * > *  q,
MySQLConnectionInfo connInfo 
)
152 : MySQLConnection(q, connInfo)
153{
154}

◆ ~LoginDatabaseConnection()

LoginDatabaseConnection::~LoginDatabaseConnection ( )
override
157{
158}

Member Function Documentation

◆ DoPrepareStatements()

void LoginDatabaseConnection::DoPrepareStatements ( )
overridevirtual

Implements MySQLConnection.

22{
23 if (!m_reconnecting)
25
27 "SELECT a.id, a.username, a.locked, a.lock_country, a.last_ip, a.failed_logins, "
28 "ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate, "
29 "ipb.unbandate > UNIX_TIMESTAMP() OR ipb.unbandate = ipb.bandate, ipb.unbandate = ipb.bandate, "
30 "aa.gmlevel, a.totp_secret, a.salt, a.verifier "
31 "FROM account a "
32 "LEFT JOIN account_access aa ON a.id = aa.id "
33 "LEFT JOIN account_banned ab ON ab.id = a.id AND ab.active = 1 "
34 "LEFT JOIN ip_banned ipb ON ipb.ip = ? "
35 "WHERE a.username = ?", CONNECTION_ASYNC);
37 "SELECT a.id, a.username, a.locked, a.lock_country, a.last_ip, a.failed_logins, "
38 "ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate, "
39 "ipb.unbandate > UNIX_TIMESTAMP() OR ipb.unbandate = ipb.bandate, ipb.unbandate = ipb.bandate, "
40 "aa.gmlevel, a.session_key "
41 "FROM account a "
42 "LEFT JOIN account_access aa ON a.id = aa.id "
43 "LEFT JOIN account_banned ab ON ab.id = a.id AND ab.active = 1 "
44 "LEFT JOIN ip_banned ipb ON ipb.ip = ? "
45 "WHERE a.username = ? AND a.session_key IS NOT NULL", CONNECTION_ASYNC);
46 PrepareStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME, "SELECT a.id, a.session_key, a.last_ip, a.locked, a.lock_country, a.expansion, a.mutetime, a.locale, a.recruiter, a.os, a.totaltime, "
47 "aa.gmlevel, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id FROM account a LEFT JOIN account_access aa ON a.id = aa.id AND aa.RealmID IN (-1, ?) "
48 "LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 LEFT JOIN account r ON a.id = r.recruiter WHERE a.username = ? "
49 "AND a.session_key IS NOT NULL ORDER BY aa.RealmID DESC LIMIT 1", CONNECTION_ASYNC);
50 PrepareStatement(LOGIN_SEL_IP_INFO, "SELECT unbandate > UNIX_TIMESTAMP() OR unbandate = bandate AS banned, NULL as country FROM ip_banned WHERE ip = ?", CONNECTION_ASYNC);
51 PrepareStatement(LOGIN_SEL_REALMLIST, "SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE flag <> 3 ORDER BY name", CONNECTION_SYNCH);
52 PrepareStatement(LOGIN_DEL_EXPIRED_IP_BANS, "DELETE FROM ip_banned WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC);
53 PrepareStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS, "UPDATE account_banned SET active = 0 WHERE active = 1 AND unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC);
54 PrepareStatement(LOGIN_SEL_IP_BANNED, "SELECT * FROM ip_banned WHERE ip = ?", CONNECTION_SYNCH);
55 PrepareStatement(LOGIN_INS_IP_AUTO_BANNED, "INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'realmd', 'Failed login autoban')", CONNECTION_ASYNC);
56 PrepareStatement(LOGIN_SEL_IP_BANNED_ALL, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) ORDER BY unbandate", CONNECTION_SYNCH);
57 PrepareStatement(LOGIN_SEL_IP_BANNED_BY_IP, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) AND ip LIKE CONCAT('%%', ?, '%%') ORDER BY unbandate", CONNECTION_SYNCH);
58 PrepareStatement(LOGIN_SEL_ACCOUNT_BANNED, "SELECT bandate, unbandate FROM account_banned WHERE id = ? AND active = 1", CONNECTION_SYNCH);
59 PrepareStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id", CONNECTION_SYNCH);
60 PrepareStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 AND username LIKE CONCAT('%%', ?, '%%') GROUP BY account.id", CONNECTION_SYNCH);
61 PrepareStatement(LOGIN_INS_ACCOUNT_AUTO_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'realmd', 'Failed login autoban', 1)", CONNECTION_ASYNC);
62 PrepareStatement(LOGIN_DEL_ACCOUNT_BANNED, "DELETE FROM account_banned WHERE id = ?", CONNECTION_ASYNC);
63 PrepareStatement(LOGIN_UPD_LOGON, "UPDATE account SET salt = ?, verifier = ? WHERE id = ?", CONNECTION_ASYNC);
64 PrepareStatement(LOGIN_UPD_LOGONPROOF, "UPDATE account SET session_key = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_SYNCH);
65 PrepareStatement(LOGIN_UPD_FAILEDLOGINS, "UPDATE account SET failed_logins = failed_logins + 1 WHERE username = ?", CONNECTION_ASYNC);
66 PrepareStatement(LOGIN_SEL_FAILEDLOGINS, "SELECT id, failed_logins FROM account WHERE username = ?", CONNECTION_SYNCH);
67 PrepareStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH);
68 PrepareStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME, "SELECT id, username FROM account WHERE username = ?", CONNECTION_SYNCH);
69 PrepareStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL, "SELECT id, username FROM account WHERE email = ?", CONNECTION_SYNCH);
70 PrepareStatement(LOGIN_SEL_NUM_CHARS_ON_REALM, "SELECT numchars FROM realmcharacters WHERE realmid = ? AND acctid= ?", CONNECTION_SYNCH);
71 PrepareStatement(LOGIN_SEL_REALM_CHARACTER_COUNTS, "SELECT realmid, numchars FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC);
72 PrepareStatement(LOGIN_SEL_ACCOUNT_BY_IP, "SELECT id, username FROM account WHERE last_ip = ?", CONNECTION_SYNCH);
73 PrepareStatement(LOGIN_SEL_ACCOUNT_BY_ID, "SELECT 1 FROM account WHERE id = ?", CONNECTION_SYNCH);
74 PrepareStatement(LOGIN_INS_IP_BANNED, "INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?)", CONNECTION_ASYNC);
75 PrepareStatement(LOGIN_DEL_IP_NOT_BANNED, "DELETE FROM ip_banned WHERE ip = ?", CONNECTION_ASYNC);
76 PrepareStatement(LOGIN_INS_ACCOUNT_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?, 1)", CONNECTION_ASYNC);
77 PrepareStatement(LOGIN_UPD_ACCOUNT_NOT_BANNED, "UPDATE account_banned SET active = 0 WHERE id = ? AND active != 0", CONNECTION_ASYNC);
78 PrepareStatement(LOGIN_DEL_REALM_CHARACTERS, "DELETE FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC);
79 PrepareStatement(LOGIN_REP_REALM_CHARACTERS, "REPLACE INTO realmcharacters (numchars, acctid, realmid) VALUES (?, ?, ?)", CONNECTION_ASYNC);
80 PrepareStatement(LOGIN_SEL_SUM_REALM_CHARACTERS, "SELECT SUM(numchars) FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC);
81 PrepareStatement(LOGIN_INS_ACCOUNT, "INSERT INTO account(username, salt, verifier, expansion, joindate) VALUES(?, ?, ?, ?, NOW())", CONNECTION_ASYNC);
82 PrepareStatement(LOGIN_INS_REALM_CHARACTERS_INIT, "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", CONNECTION_ASYNC);
83 PrepareStatement(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC);
84 PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC);
85 PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK_COUNTRY, "UPDATE account SET lock_country = ? WHERE id = ?", CONNECTION_ASYNC);
86 PrepareStatement(LOGIN_UPD_EMAIL, "UPDATE account SET email = ? WHERE id = ?", CONNECTION_ASYNC);
87 PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET username = ? WHERE id = ?", CONNECTION_ASYNC);
88 PrepareStatement(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? , mutereason = ? , muteby = ? WHERE id = ?", CONNECTION_ASYNC);
89 PrepareStatement(LOGIN_UPD_MUTE_TIME_LOGIN, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
90 PrepareStatement(LOGIN_UPD_LAST_IP, "UPDATE account SET last_ip = ? WHERE username = ?", CONNECTION_ASYNC);
91 PrepareStatement(LOGIN_UPD_LAST_ATTEMPT_IP, "UPDATE account SET last_attempt_ip = ? WHERE username = ?", CONNECTION_ASYNC);
92 PrepareStatement(LOGIN_UPD_ACCOUNT_ONLINE, "UPDATE account SET online = ? WHERE id = ?", CONNECTION_ASYNC);
93 PrepareStatement(LOGIN_UPD_UPTIME_PLAYERS, "UPDATE uptime SET uptime = ?, maxplayers = ? WHERE realmid = ? AND starttime = ?", CONNECTION_ASYNC);
94 PrepareStatement(LOGIN_DEL_OLD_LOGS, "DELETE FROM logs WHERE (time + ?) < ?", CONNECTION_ASYNC);
95 PrepareStatement(LOGIN_DEL_ACCOUNT_ACCESS, "DELETE FROM account_access WHERE id = ?", CONNECTION_ASYNC);
96 PrepareStatement(LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM, "DELETE FROM account_access WHERE id = ? AND (RealmID = ? OR RealmID = -1)", CONNECTION_ASYNC);
97 PrepareStatement(LOGIN_INS_ACCOUNT_ACCESS, "INSERT INTO account_access (id,gmlevel,RealmID) VALUES (?, ?, ?)", CONNECTION_ASYNC);
98 PrepareStatement(LOGIN_GET_ACCOUNT_ID_BY_USERNAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH);
99 PrepareStatement(LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL, "SELECT gmlevel FROM account_access WHERE id = ?", CONNECTION_SYNCH);
100 PrepareStatement(LOGIN_GET_GMLEVEL_BY_REALMID, "SELECT gmlevel FROM account_access WHERE id = ? AND (RealmID = ? OR RealmID = -1)", CONNECTION_SYNCH);
101 PrepareStatement(LOGIN_GET_USERNAME_BY_ID, "SELECT username FROM account WHERE id = ?", CONNECTION_SYNCH);
102 PrepareStatement(LOGIN_SEL_CHECK_PASSWORD, "SELECT salt, verifier FROM account WHERE id = ?", CONNECTION_SYNCH);
103 PrepareStatement(LOGIN_SEL_CHECK_PASSWORD_BY_NAME, "SELECT salt, verifier FROM account WHERE username = ?", CONNECTION_SYNCH);
104 PrepareStatement(LOGIN_SEL_PINFO, "SELECT a.username, aa.gmlevel, a.email, a.reg_mail, a.last_ip, DATE_FORMAT(a.last_login, '%Y-%m-%d %T'), a.mutetime, a.mutereason, a.muteby, a.failed_logins, a.locked, a.OS FROM account a LEFT JOIN account_access aa ON (a.id = aa.id AND (aa.RealmID = ? OR aa.RealmID = -1)) WHERE a.id = ?", CONNECTION_SYNCH);
105 PrepareStatement(LOGIN_SEL_PINFO_BANS, "SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned WHERE id = ? AND active ORDER BY bandate ASC LIMIT 1", CONNECTION_SYNCH);
106 PrepareStatement(LOGIN_SEL_GM_ACCOUNTS, "SELECT a.username, aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel >= ? AND (aa.realmid = -1 OR aa.realmid = ?)", CONNECTION_SYNCH);
107 PrepareStatement(LOGIN_SEL_ACCOUNT_INFO, "SELECT a.username, a.last_ip, aa.gmlevel, a.expansion FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.id = ? ORDER BY a.last_ip", CONNECTION_SYNCH); // Only used in ".account onlinelist" command
108 PrepareStatement(LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST, "SELECT 1 FROM account_access WHERE id = ? AND gmlevel > ?", CONNECTION_SYNCH);
109 PrepareStatement(LOGIN_SEL_ACCOUNT_ACCESS, "SELECT a.id, aa.gmlevel, aa.RealmID FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = ?", CONNECTION_SYNCH);
110 PrepareStatement(LOGIN_SEL_ACCOUNT_RECRUITER, "SELECT 1 FROM account WHERE recruiter = ?", CONNECTION_SYNCH);
111 PrepareStatement(LOGIN_SEL_BANS, "SELECT 1 FROM account_banned WHERE id = ? AND active = 1 UNION SELECT 1 FROM ip_banned WHERE ip = ?", CONNECTION_SYNCH);
112 PrepareStatement(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
113 PrepareStatement(LOGIN_SEL_LAST_ATTEMPT_IP, "SELECT last_attempt_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
114 PrepareStatement(LOGIN_SEL_LAST_IP, "SELECT last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
115 PrepareStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH);
116 PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC);
117 PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH);
118 PrepareStatement(LOGIN_SEL_MOTD, "SELECT text FROM motd WHERE realmid = ? OR realmid = -1 ORDER BY realmid DESC", CONNECTION_SYNCH);
119 PrepareStatement(LOGIN_SEL_MOTD_LOCALE, "SELECT locale, text FROM motd_localized WHERE realmid = ? OR realmid = -1 ORDER BY realmid DESC", CONNECTION_SYNCH);
120 PrepareStatement(LOGIN_INS_MOTD, "INSERT INTO motd (realmid, text) VALUES (?, ?) ON DUPLICATE KEY UPDATE text = ?", CONNECTION_ASYNC);
121 PrepareStatement(LOGIN_INS_MOTD_LOCALE, "INSERT INTO motd_localized (realmid, locale, text) VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE text = ?;", CONNECTION_ASYNC);
122 PrepareStatement(LOGIN_INS_ACCOUNT_MUTE, "INSERT INTO account_muted VALUES (?, UNIX_TIMESTAMP(), ?, ?, ?)", CONNECTION_ASYNC);
123 PrepareStatement(LOGIN_SEL_ACCOUNT_MUTE_INFO, "SELECT mutedate, mutetime, mutereason, mutedby FROM account_muted WHERE guid = ? ORDER BY mutedate ASC", CONNECTION_SYNCH);
124 PrepareStatement(LOGIN_DEL_ACCOUNT_MUTED, "DELETE FROM account_muted WHERE guid = ?", CONNECTION_ASYNC);
125 // 0: uint32, 1: uint32, 2: uint8, 3: uint32, 4: string // Complete name: "Login_Insert_AccountLoginDeLete_IP_Logging"
126 PrepareStatement(LOGIN_INS_ALDL_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, (SELECT last_ip FROM account WHERE id = ?), ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
127 // 0: uint32, 1: uint32, 2: uint8, 3: uint32, 4: string // Complete name: "Login_Insert_FailedAccountLogin_IP_Logging"
128 PrepareStatement(LOGIN_INS_FACL_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, (SELECT last_attempt_ip FROM account WHERE id = ?), ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
129 // 0: uint32, 1: uint32, 2: uint8, 3: string, 4: string // Complete name: "Login_Insert_CharacterDelete_IP_Logging"
130 PrepareStatement(LOGIN_INS_CHAR_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, ?, ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
131 // 0: string, 1: string, 2: string // Complete name: "Login_Insert_Failed_Account_Login_due_password_IP_Logging"
132 PrepareStatement(LOGIN_INS_FALP_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, 0, 1, ?, ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
133
134 // DB logging
135 PrepareStatement(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
136
137 // TOTP
138 PrepareStatement(LOGIN_SEL_SECRET_DIGEST, "SELECT digest FROM secret_digest WHERE id = ?", CONNECTION_SYNCH);
139 PrepareStatement(LOGIN_INS_SECRET_DIGEST, "INSERT INTO secret_digest (id, digest) VALUES (?,?)", CONNECTION_ASYNC);
140 PrepareStatement(LOGIN_DEL_SECRET_DIGEST, "DELETE FROM secret_digest WHERE id = ?", CONNECTION_ASYNC);
141
142 PrepareStatement(LOGIN_SEL_ACCOUNT_TOTP_SECRET, "SELECT totp_secret FROM account WHERE id = ?", CONNECTION_SYNCH);
143 PrepareStatement(LOGIN_UPD_ACCOUNT_TOTP_SECRET, "UPDATE account SET totp_secret = ? WHERE id = ?", CONNECTION_ASYNC);
144
145 PrepareStatement(LOGIN_INS_UPTIME, "INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES (?, ?, 0, ?)", CONNECTION_ASYNC);
146}
@ LOGIN_UPD_MUTE_TIME_LOGIN
Definition: LoginDatabase.h:73
@ LOGIN_INS_ACCOUNT_BANNED
Definition: LoginDatabase.h:60
@ LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL
Definition: LoginDatabase.h:51
@ LOGIN_INS_ACCOUNT_AUTO_BANNED
Definition: LoginDatabase.h:40
@ LOGIN_INS_LOG
Definition: LoginDatabase.h:115
@ LOGIN_UPD_EMAIL
Definition: LoginDatabase.h:70
@ LOGIN_SEL_ACCOUNT_BY_IP
Definition: LoginDatabase.h:54
@ LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM
Definition: LoginDatabase.h:80
@ LOGIN_GET_ACCOUNT_ID_BY_USERNAME
Definition: LoginDatabase.h:82
@ LOGIN_UPD_UPTIME_PLAYERS
Definition: LoginDatabase.h:77
@ LOGIN_SEL_LAST_ATTEMPT_IP
Definition: LoginDatabase.h:104
@ LOGIN_DEL_IP_NOT_BANNED
Definition: LoginDatabase.h:56
@ LOGIN_SEL_ACCOUNT_BY_ID
Definition: LoginDatabase.h:59
@ LOGIN_INS_ALDL_IP_LOGGING
Definition: LoginDatabase.h:106
@ LOGIN_DEL_ACCOUNT_MUTED
Definition: LoginDatabase.h:113
@ LOGIN_REP_REALM_CHARACTERS
Definition: LoginDatabase.h:63
@ LOGIN_DEL_ACCOUNT_BANNED
Definition: LoginDatabase.h:41
@ LOGIN_DEL_EXPIRED_IP_BANS
Definition: LoginDatabase.h:32
@ LOGIN_SEL_CHECK_PASSWORD_BY_NAME
Definition: LoginDatabase.h:87
@ LOGIN_SEL_BANS
Definition: LoginDatabase.h:95
@ LOGIN_SEL_PINFO
Definition: LoginDatabase.h:88
@ LOGIN_INS_MOTD_LOCALE
Definition: LoginDatabase.h:103
@ MAX_LOGINDATABASE_STATEMENTS
Definition: LoginDatabase.h:126
@ LOGIN_UPD_ACCOUNT_TOTP_SECRET
Definition: LoginDatabase.h:122
@ LOGIN_SEL_IP_BANNED
Definition: LoginDatabase.h:35
@ LOGIN_UPD_LAST_ATTEMPT_IP
Definition: LoginDatabase.h:75
@ LOGIN_DEL_ACCOUNT_ACCESS
Definition: LoginDatabase.h:79
@ LOGIN_SEL_ACCOUNT_WHOIS
Definition: LoginDatabase.h:96
@ LOGIN_SEL_MOTD_LOCALE
Definition: LoginDatabase.h:101
@ LOGIN_UPD_USERNAME
Definition: LoginDatabase.h:71
@ LOGIN_INS_IP_BANNED
Definition: LoginDatabase.h:55
@ LOGIN_SEL_SECRET_DIGEST
Definition: LoginDatabase.h:117
@ LOGIN_SEL_REALMLIST
Definition: LoginDatabase.h:31
@ LOGIN_SEL_IP_BANNED_BY_IP
Definition: LoginDatabase.h:58
@ LOGIN_GET_GMLEVEL_BY_REALMID
Definition: LoginDatabase.h:84
@ LOGIN_UPD_EXPANSION
Definition: LoginDatabase.h:67
@ LOGIN_UPD_ACCOUNT_LOCK_COUNTRY
Definition: LoginDatabase.h:69
@ LOGIN_SEL_REALMLIST_SECURITY_LEVEL
Definition: LoginDatabase.h:97
@ LOGIN_INS_SECRET_DIGEST
Definition: LoginDatabase.h:118
@ LOGIN_SEL_ACCOUNT_MUTE_INFO
Definition: LoginDatabase.h:112
@ LOGIN_UPD_ACCOUNT_NOT_BANNED
Definition: LoginDatabase.h:61
@ LOGIN_SEL_GM_ACCOUNTS
Definition: LoginDatabase.h:90
@ LOGIN_UPD_LOGON
Definition: LoginDatabase.h:42
@ LOGIN_SEL_ACCOUNT_LIST_BY_NAME
Definition: LoginDatabase.h:49
@ LOGIN_SEL_ACCOUNT_TOTP_SECRET
Definition: LoginDatabase.h:121
@ LOGIN_INS_FALP_IP_LOGGING
Definition: LoginDatabase.h:109
@ LOGIN_UPD_MUTE_TIME
Definition: LoginDatabase.h:72
@ LOGIN_UPD_LAST_IP
Definition: LoginDatabase.h:74
@ LOGIN_UPD_LOGONPROOF
Definition: LoginDatabase.h:43
@ LOGIN_UPD_ACCOUNT_LOCK
Definition: LoginDatabase.h:68
@ LOGIN_SEL_AUTOBROADCAST
Definition: LoginDatabase.h:99
@ LOGIN_SEL_SUM_REALM_CHARACTERS
Definition: LoginDatabase.h:64
@ LOGIN_UPD_ACCOUNT_ONLINE
Definition: LoginDatabase.h:76
@ LOGIN_GET_USERNAME_BY_ID
Definition: LoginDatabase.h:85
@ LOGIN_DEL_ACCOUNT
Definition: LoginDatabase.h:98
@ LOGIN_SEL_LAST_IP
Definition: LoginDatabase.h:105
@ LOGIN_SEL_FAILEDLOGINS
Definition: LoginDatabase.h:47
@ LOGIN_INS_REALM_CHARACTERS_INIT
Definition: LoginDatabase.h:66
@ LOGIN_SEL_IP_INFO
Definition: LoginDatabase.h:34
@ LOGIN_SEL_NUM_CHARS_ON_REALM
Definition: LoginDatabase.h:52
@ LOGIN_DEL_SECRET_DIGEST
Definition: LoginDatabase.h:119
@ LOGIN_UPD_EXPIRED_ACCOUNT_BANS
Definition: LoginDatabase.h:33
@ LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME
Definition: LoginDatabase.h:39
@ LOGIN_INS_FACL_IP_LOGGING
Definition: LoginDatabase.h:107
@ LOGIN_INS_CHAR_IP_LOGGING
Definition: LoginDatabase.h:108
@ LOGIN_SEL_RECONNECTCHALLENGE
Definition: LoginDatabase.h:45
@ LOGIN_INS_ACCOUNT_ACCESS
Definition: LoginDatabase.h:81
@ LOGIN_DEL_REALM_CHARACTERS
Definition: LoginDatabase.h:62
@ LOGIN_SEL_CHECK_PASSWORD
Definition: LoginDatabase.h:86
@ LOGIN_SEL_PINFO_BANS
Definition: LoginDatabase.h:89
@ LOGIN_SEL_ACCOUNT_ID_BY_NAME
Definition: LoginDatabase.h:48
@ LOGIN_UPD_FAILEDLOGINS
Definition: LoginDatabase.h:46
@ LOGIN_SEL_ACCOUNT_ACCESS
Definition: LoginDatabase.h:93
@ LOGIN_INS_MOTD
Definition: LoginDatabase.h:102
@ LOGIN_SEL_IP_BANNED_ALL
Definition: LoginDatabase.h:57
@ LOGIN_SEL_ACCOUNT_RECRUITER
Definition: LoginDatabase.h:94
@ LOGIN_INS_IP_AUTO_BANNED
Definition: LoginDatabase.h:36
@ LOGIN_SEL_ACCOUNT_INFO
Definition: LoginDatabase.h:91
@ LOGIN_SEL_ACCOUNT_BANNED
Definition: LoginDatabase.h:37
@ LOGIN_SEL_LOGONCHALLENGE
Definition: LoginDatabase.h:44
@ LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST
Definition: LoginDatabase.h:92
@ LOGIN_DEL_OLD_LOGS
Definition: LoginDatabase.h:78
@ LOGIN_SEL_ACCOUNT_BANNED_ALL
Definition: LoginDatabase.h:38
@ LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL
Definition: LoginDatabase.h:83
@ LOGIN_SEL_REALM_CHARACTER_COUNTS
Definition: LoginDatabase.h:53
@ LOGIN_SEL_MOTD
Definition: LoginDatabase.h:100
@ LOGIN_SEL_ACCOUNT_INFO_BY_NAME
Definition: LoginDatabase.h:50
@ LOGIN_INS_ACCOUNT_MUTE
Definition: LoginDatabase.h:111
@ LOGIN_INS_UPTIME
Definition: LoginDatabase.h:124
@ LOGIN_INS_ACCOUNT
Definition: LoginDatabase.h:65
@ CONNECTION_SYNCH
Definition: MySQLConnection.h:38
@ CONNECTION_ASYNC
Definition: MySQLConnection.h:37
void PrepareStatement(uint32 index, std::string_view sql, ConnectionFlags flags)
Definition: MySQLConnection.cpp:505
PreparedStatementContainer m_stmts
Definition: MySQLConnection.h:105
bool m_reconnecting
PreparedStatements storage.
Definition: MySQLConnection.h:106

References CONNECTION_ASYNC, CONNECTION_SYNCH, LOGIN_DEL_ACCOUNT, LOGIN_DEL_ACCOUNT_ACCESS, LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM, LOGIN_DEL_ACCOUNT_BANNED, LOGIN_DEL_ACCOUNT_MUTED, LOGIN_DEL_EXPIRED_IP_BANS, LOGIN_DEL_IP_NOT_BANNED, LOGIN_DEL_OLD_LOGS, LOGIN_DEL_REALM_CHARACTERS, LOGIN_DEL_SECRET_DIGEST, LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL, LOGIN_GET_ACCOUNT_ID_BY_USERNAME, LOGIN_GET_GMLEVEL_BY_REALMID, LOGIN_GET_USERNAME_BY_ID, LOGIN_INS_ACCOUNT, LOGIN_INS_ACCOUNT_ACCESS, LOGIN_INS_ACCOUNT_AUTO_BANNED, LOGIN_INS_ACCOUNT_BANNED, LOGIN_INS_ACCOUNT_MUTE, LOGIN_INS_ALDL_IP_LOGGING, LOGIN_INS_CHAR_IP_LOGGING, LOGIN_INS_FACL_IP_LOGGING, LOGIN_INS_FALP_IP_LOGGING, LOGIN_INS_IP_AUTO_BANNED, LOGIN_INS_IP_BANNED, LOGIN_INS_LOG, LOGIN_INS_MOTD, LOGIN_INS_MOTD_LOCALE, LOGIN_INS_REALM_CHARACTERS_INIT, LOGIN_INS_SECRET_DIGEST, LOGIN_INS_UPTIME, LOGIN_REP_REALM_CHARACTERS, LOGIN_SEL_ACCOUNT_ACCESS, LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST, LOGIN_SEL_ACCOUNT_BANNED, LOGIN_SEL_ACCOUNT_BANNED_ALL, LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, LOGIN_SEL_ACCOUNT_BY_ID, LOGIN_SEL_ACCOUNT_BY_IP, LOGIN_SEL_ACCOUNT_ID_BY_NAME, LOGIN_SEL_ACCOUNT_INFO, LOGIN_SEL_ACCOUNT_INFO_BY_NAME, LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL, LOGIN_SEL_ACCOUNT_LIST_BY_NAME, LOGIN_SEL_ACCOUNT_MUTE_INFO, LOGIN_SEL_ACCOUNT_RECRUITER, LOGIN_SEL_ACCOUNT_TOTP_SECRET, LOGIN_SEL_ACCOUNT_WHOIS, LOGIN_SEL_AUTOBROADCAST, LOGIN_SEL_BANS, LOGIN_SEL_CHECK_PASSWORD, LOGIN_SEL_CHECK_PASSWORD_BY_NAME, LOGIN_SEL_FAILEDLOGINS, LOGIN_SEL_GM_ACCOUNTS, LOGIN_SEL_IP_BANNED, LOGIN_SEL_IP_BANNED_ALL, LOGIN_SEL_IP_BANNED_BY_IP, LOGIN_SEL_IP_INFO, LOGIN_SEL_LAST_ATTEMPT_IP, LOGIN_SEL_LAST_IP, LOGIN_SEL_LOGONCHALLENGE, LOGIN_SEL_MOTD, LOGIN_SEL_MOTD_LOCALE, LOGIN_SEL_NUM_CHARS_ON_REALM, LOGIN_SEL_PINFO, LOGIN_SEL_PINFO_BANS, LOGIN_SEL_REALM_CHARACTER_COUNTS, LOGIN_SEL_REALMLIST, LOGIN_SEL_REALMLIST_SECURITY_LEVEL, LOGIN_SEL_RECONNECTCHALLENGE, LOGIN_SEL_SECRET_DIGEST, LOGIN_SEL_SUM_REALM_CHARACTERS, LOGIN_UPD_ACCOUNT_LOCK, LOGIN_UPD_ACCOUNT_LOCK_COUNTRY, LOGIN_UPD_ACCOUNT_NOT_BANNED, LOGIN_UPD_ACCOUNT_ONLINE, LOGIN_UPD_ACCOUNT_TOTP_SECRET, LOGIN_UPD_EMAIL, LOGIN_UPD_EXPANSION, LOGIN_UPD_EXPIRED_ACCOUNT_BANS, LOGIN_UPD_FAILEDLOGINS, LOGIN_UPD_LAST_ATTEMPT_IP, LOGIN_UPD_LAST_IP, LOGIN_UPD_LOGON, LOGIN_UPD_LOGONPROOF, LOGIN_UPD_MUTE_TIME, LOGIN_UPD_MUTE_TIME_LOGIN, LOGIN_UPD_UPTIME_PLAYERS, LOGIN_UPD_USERNAME, MySQLConnection::m_reconnecting, MySQLConnection::m_stmts, MAX_LOGINDATABASE_STATEMENTS, and MySQLConnection::PrepareStatement().