From e8b476bea986691e10f69b93343dd3f578fb00fb Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 13 Nov 2019 17:00:11 +0000 Subject: Refactor the MySQL code slightly. --- src/modules/extra/m_mysql.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index d94c75917..6c0493413 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -168,7 +168,10 @@ class MySQLresult : public SQL::Result std::vector colnames; std::vector fieldlists; - MySQLresult(MYSQL_RES* res, int affected_rows) : err(SQL::SUCCESS), currentrow(0), rows(0) + MySQLresult(MYSQL_RES* res, int affected_rows) + : err(SQL::SUCCESS) + , currentrow(0) + , rows(0) { if (affected_rows >= 1) { @@ -211,7 +214,10 @@ class MySQLresult : public SQL::Result } } - MySQLresult(SQL::Error& e) : err(e) + MySQLresult(SQL::Error& e) + : err(e) + , currentrow(0) + , rows(0) { } @@ -308,7 +314,7 @@ class SQLConnection : public SQL::Provider ~SQLConnection() { - Close(); + mysql_close(connection); } // This method connects to the database using the credentials supplied to the constructor, and returns @@ -387,11 +393,6 @@ class SQLConnection : public SQL::Provider return true; } - void Close() - { - mysql_close(connection); - } - void Submit(SQL::Query* q, const std::string& qs) CXX11_OVERRIDE { ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Executing MySQL query: " + qs); @@ -439,8 +440,8 @@ class SQLConnection : public SQL::Provider }; ModuleSQL::ModuleSQL() + : Dispatcher(NULL) { - Dispatcher = NULL; } void ModuleSQL::init() -- cgit v1.2.3