Core/Database: Close the MySQL connection only after getting the last error code

(cherry picked from commit 3230ca74d21517204bb785e9ec799d995295ad28)
This commit is contained in:
Giacomo Pozzoni
2021-11-27 01:25:47 +01:00
committed by Shauren
parent cb27083b36
commit d37a8ea038
@@ -154,8 +154,9 @@ uint32 MySQLConnection::Open()
else
{
TC_LOG_ERROR("sql.sql", "Could not connect to MySQL database at %s: %s", m_connectionInfo.host.c_str(), mysql_error(mysqlInit));
uint32 errorCode = mysql_errno(mysqlInit);
mysql_close(mysqlInit);
return mysql_errno(mysqlInit);
return errorCode;
}
}