diff options
author | Peter Powell <petpow@saberuk.com> | 2019-11-13 17:00:11 +0000 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2019-11-16 22:05:42 +0000 |
commit | e8b476bea986691e10f69b93343dd3f578fb00fb (patch) | |
tree | 5a551f16b09c8954f307c9a0f6dfbcb69c6b8895 /src | |
parent | 05066eb189e177c4385d3f19a5181473331e7f87 (diff) |
Refactor the MySQL code slightly.
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
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<std::string> colnames; std::vector<SQL::Row> 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() |