summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-05-11 14:17:10 +0100
committerSadie Powell <sadie@witchery.services>2024-05-11 14:24:37 +0100
commit1cf5918574468c04c93f588b63b3531ea5768a89 (patch)
tree243170a189d277f4c960b18e17cbbe9f28fbe068
parentff1c5adb8bfbdd76e5c44860649fa0f7f0101982 (diff)
parentafe87bf69354c87506fa7544e4d0945046a5b303 (diff)
Merge branch '2.0' into 2.1.
-rw-r--r--modules/extra/mysql.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/extra/mysql.cpp b/modules/extra/mysql.cpp
index 72c026dad..aa9986db9 100644
--- a/modules/extra/mysql.cpp
+++ b/modules/extra/mysql.cpp
@@ -354,9 +354,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);