1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 00:43:12 +02:00

Ensure we are connected to MySQL before trying to escape data.

This commit is contained in:
Sadie Powell
2024-05-11 11:36:29 +01:00
parent 0c5bf51378
commit afe87bf693
+7 -2
View File
@@ -339,9 +339,14 @@ Result MySQLService::RunQuery(const Query &query)
{
this->Lock.Lock();
Anope::string real_query = this->BuildQuery(query);
if (!this->CheckConnection())
{
this->Lock.Unlock();
return MySQLResult(query, query.query, mysql_error(this->sql));
}
if (this->CheckConnection() && !mysql_real_query(this->sql, real_query.c_str(), real_query.length()))
Anope::string real_query = this->BuildQuery(query);
if (!mysql_real_query(this->sql, real_query.c_str(), real_query.length()))
{
MYSQL_RES *res = mysql_store_result(this->sql);
unsigned int id = mysql_insert_id(this->sql);