Remove old DB connector

This commit is contained in:
Akkadius 2019-07-04 23:29:54 -05:00
parent 8ad4ef503b
commit d5eb015533
2 changed files with 16 additions and 41 deletions

View File

@ -590,7 +590,6 @@ void Client::DoSuccessfulLogin(const std::string &user, int db_account_id, const
in.s_addr = connection->GetRemoteIP();
server.db->UpdateLSAccountData(db_account_id, std::string(inet_ntoa(in)));
GenerateKey();
account_id = db_account_id;

View File

@ -50,25 +50,6 @@ Database::Database(
this->host = host;
this->name = name;
database = mysql_init(nullptr);
if (database) {
char r = 1;
mysql_options(database, MYSQL_OPT_RECONNECT, &r);
if (!mysql_real_connect(
database,
host.c_str(),
user.c_str(),
pass.c_str(),
name.c_str(),
atoi(port.c_str()),
nullptr,
0
)) {
mysql_close(database);
Log(Logs::General, Logs::Error, "Failed to connect to MySQL database. Error: %s", mysql_error(database));
exit(1);
}
uint32 errnum = 0;
char errbuf[MYSQL_ERRMSG_SIZE];
if (!Open(
@ -87,11 +68,6 @@ Database::Database(
else {
Log(Logs::General, Logs::Status, "Using database '%s' at %s:%d", database, host, port);
}
}
else {
Log(Logs::General, Logs::Error, "Failed to create db object in MySQL database.");
}
}
/**
@ -438,7 +414,7 @@ bool Database::GetWorldRegistration(
void Database::UpdateLSAccountData(unsigned int id, std::string ip_address)
{
auto query = fmt::format(
"UPDATE {0} SET LastIPAddress = '{2}', LastLoginDate = now() where LoginServerId = {3}",
"UPDATE {0} SET LastIPAddress = '{1}', LastLoginDate = NOW() where LoginServerId = {2}",
server.options.GetAccountTable(),
ip_address,
id