diff options
Diffstat (limited to 'modules/extra/m_mysql.cpp')
-rw-r--r-- | modules/extra/m_mysql.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index b08f33c05..83fc3b73e 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -11,7 +11,7 @@ #include "module.h" #include "modules/sql.h" -#define NO_CLIENT_LONG_LONG + #ifdef WIN32 # include <mysql.h> #else @@ -61,7 +61,7 @@ struct QueryResult */ class MySQLResult : public Result { - MYSQL_RES *res; + MYSQL_RES *res = nullptr; public: MySQLResult(unsigned int i, const Query &q, const Anope::string &fq, MYSQL_RES *r) : Result(i, q, fq), res(r) @@ -94,7 +94,7 @@ class MySQLResult : public Result } } - MySQLResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err), res(NULL) + MySQLResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err) { } @@ -117,7 +117,7 @@ class MySQLService : public Provider Anope::string password; int port; - MYSQL *sql; + MYSQL *sql = nullptr; /** Escape a query. * Note the mutex must be held! @@ -135,15 +135,15 @@ class MySQLService : public Provider ~MySQLService(); - void Run(Interface *i, const Query &query) anope_override; + void Run(Interface *i, const Query &query) override; - Result RunQuery(const Query &query) anope_override; + Result RunQuery(const Query &query) override; - std::vector<Query> CreateTable(const Anope::string &table, const Data &data) anope_override; + std::vector<Query> CreateTable(const Anope::string &table, const Data &data) override; - Query BuildInsert(const Anope::string &table, unsigned int id, Data &data) anope_override; + Query BuildInsert(const Anope::string &table, unsigned int id, Data &data) override; - Query GetTables(const Anope::string &prefix) anope_override; + Query GetTables(const Anope::string &prefix) override; void Connect(); @@ -151,7 +151,7 @@ class MySQLService : public Provider Anope::string BuildQuery(const Query &q); - Anope::string FromUnixtime(time_t); + Anope::string FromUnixtime(time_t) override; }; /** The SQL thread used to execute queries @@ -161,7 +161,7 @@ class DispatcherThread : public Thread, public Condition public: DispatcherThread() : Thread() { } - void Run() anope_override; + void Run() override; }; class ModuleSQL; @@ -199,7 +199,7 @@ class ModuleSQL : public Module, public Pipe delete DThread; } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *config = conf->GetModule(this); @@ -240,7 +240,7 @@ class ModuleSQL : public Module, public Pipe try { MySQLService *ss = new MySQLService(this, connname, database, server, user, password, port); - this->MySQLServices.insert(std::make_pair(connname, ss)); + this->MySQLServices.emplace(connname, ss); Log(LOG_NORMAL, "mysql") << "MySQL: Successfully connected to server " << connname << " (" << server << ")"; } @@ -252,7 +252,7 @@ class ModuleSQL : public Module, public Pipe } } - void OnModuleUnload(User *, Module *m) anope_override + void OnModuleUnload(User *, Module *m) override { this->DThread->Lock(); @@ -277,7 +277,7 @@ class ModuleSQL : public Module, public Pipe this->OnNotify(); } - void OnNotify() anope_override + void OnNotify() override { this->DThread->Lock(); std::deque<QueryResult> finishedRequests = this->FinishedRequests; @@ -300,7 +300,7 @@ class ModuleSQL : public Module, public Pipe }; MySQLService::MySQLService(Module *o, const Anope::string &n, const Anope::string &d, const Anope::string &s, const Anope::string &u, const Anope::string &p, int po) -: Provider(o, n), database(d), server(s), user(u), password(p), port(po), sql(NULL) +: Provider(o, n), database(d), server(s), user(u), password(p), port(po) { Connect(); } |