diff options
-rw-r--r-- | src/modules/extra/m_mysql.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_pgsql.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_sqlauth.cpp | 4 | ||||
-rw-r--r-- | src/modules/extra/m_sqlite3.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_sqllog.cpp | 25 | ||||
-rw-r--r-- | src/modules/extra/m_sqloper.cpp | 4 | ||||
-rw-r--r-- | src/modules/extra/m_sqlutils.cpp | 1 | ||||
-rw-r--r-- | src/modules/extra/m_sqlv2.h | 12 | ||||
-rw-r--r-- | src/modules/extra/m_testclient.cpp | 5 |
9 files changed, 24 insertions, 33 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 485c5542d..1feb3b02b 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -22,7 +22,7 @@ /* VERSION 2 API: With nonblocking (threaded) requests */ /* $ModDesc: SQL Service Provider module for all other m_sql* modules */ -/* $CompileFlags: -Wno-variadic-macros exec("mysql_config --include") */ +/* $CompileFlags: exec("mysql_config --include") */ /* $LinkerFlags: exec("mysql_config --libs_r") rpath("mysql_config --libs_r") */ /* $ModDep: m_sqlv2.h */ /* $NoPedantic */ diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index e9179ee24..34e653e2a 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -22,7 +22,7 @@ #include "m_sqlv2.h" /* $ModDesc: PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API */ -/* $CompileFlags: -Wno-variadic-macros -Iexec("pg_config --includedir") eval("my $s = `pg_config --version`;$s =~ /^.*?(\d+)\.(\d+)\.(\d+).*?$/;my $v = hex(sprintf("0x%02x%02x%02x", $1, $2, $3));print "-DPGSQL_HAS_ESCAPECONN" if(($v >= 0x080104) || ($v >= 0x07030F && $v < 0x070400) || ($v >= 0x07040D && $v < 0x080000) || ($v >= 0x080008 && $v < 0x080100));") */ +/* $CompileFlags: -Iexec("pg_config --includedir") eval("my $s = `pg_config --version`;$s =~ /^.*?(\d+)\.(\d+)\.(\d+).*?$/;my $v = hex(sprintf("0x%02x%02x%02x", $1, $2, $3));print "-DPGSQL_HAS_ESCAPECONN" if(($v >= 0x080104) || ($v >= 0x07030F && $v < 0x070400) || ($v >= 0x07040D && $v < 0x080000) || ($v >= 0x080008 && $v < 0x080100));") */ /* $LinkerFlags: -Lexec("pg_config --libdir") -lpq */ /* $ModDep: m_sqlv2.h */ diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 4ebc7ba09..76ce4850a 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -20,7 +20,6 @@ /* $ModDesc: Allow/Deny connections based upon an arbitary SQL table */ /* $ModDep: m_sqlv2.h m_sqlutils.h */ -/* $CompileFlags: -Wno-variadic-macros */ class ModuleSQLAuth : public Module { @@ -105,7 +104,8 @@ public: bool CheckCredentials(User* user) { - SQLrequest req = SQLreq(this, SQLprovider, databaseid, "SELECT ? FROM ? WHERE ? = '?' AND ? = ?'?')", userfield, usertable, userfield, user->nick, passfield, encryption, user->password); + SQLrequest req = SQLrequest(this, SQLprovider, databaseid, SQLquery("SELECT ? FROM ? WHERE ? = '?' AND ? = ?'?')") % userfield % usertable % userfield % user->nick % + passfield % encryption % user->password); if(req.Send()) { diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 77b269e04..a12d6ad1e 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -20,7 +20,7 @@ #include "m_sqlv2.h" /* $ModDesc: sqlite3 provider */ -/* $CompileFlags: -Wno-variadic-macros pkgconfversion("sqlite3","3.3") pkgconfincludes("sqlite3","/sqlite3.h","") */ +/* $CompileFlags: pkgconfversion("sqlite3","3.3") pkgconfincludes("sqlite3","/sqlite3.h","") */ /* $LinkerFlags: pkgconflibs("sqlite3","/libsqlite3.so","-lsqlite3") */ /* $ModDep: m_sqlv2.h */ diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 7f655a45b..4f3256524 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -18,8 +18,6 @@ #include "configreader.h" #include "m_sqlv2.h" -/* $CompileFlags: -Wno-variadic-macros */ - static Module* SQLModule; static Module* MyMod; static std::string dbid; @@ -62,14 +60,14 @@ public: void Go(SQLresult* res) { - SQLrequest req = SQLreq(MyMod, SQLModule, dbid, "", ""); + SQLrequest req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("")); switch (qs) { case FIND_SOURCE: if (res->Rows() && sourceid == -1 && !insert) { sourceid = atoi(res->GetValue(0,0).d.c_str()); - req = SQLreq(MyMod, SQLModule, dbid, "SELECT id,actor FROM ircd_log_actors WHERE actor='?'", nick); + req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("SELECT id,actor FROM ircd_log_actors WHERE actor='?'") % nick); if(req.Send()) { insert = false; @@ -79,7 +77,7 @@ public: } else if (res->Rows() && sourceid == -1 && insert) { - req = SQLreq(MyMod, SQLModule, dbid, "SELECT id,actor FROM ircd_log_actors WHERE actor='?'", source); + req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("SELECT id,actor FROM ircd_log_actors WHERE actor='?'") % source); if(req.Send()) { insert = false; @@ -89,7 +87,7 @@ public: } else { - req = SQLreq(MyMod, SQLModule, dbid, "INSERT INTO ircd_log_actors (actor) VALUES('?')", source); + req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("INSERT INTO ircd_log_actors (actor) VALUES('?')") % source); if(req.Send()) { insert = true; @@ -103,7 +101,7 @@ public: if (res->Rows() && nickid == -1 && !insert) { nickid = atoi(res->GetValue(0,0).d.c_str()); - req = SQLreq(MyMod, SQLModule, dbid, "SELECT id,hostname FROM ircd_log_hosts WHERE hostname='?'", hostname); + req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("SELECT id,hostname FROM ircd_log_hosts WHERE hostname='?'") % hostname); if(req.Send()) { insert = false; @@ -113,7 +111,7 @@ public: } else if (res->Rows() && nickid == -1 && insert) { - req = SQLreq(MyMod, SQLModule, dbid, "SELECT id,actor FROM ircd_log_actors WHERE actor='?'", nick); + req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("SELECT id,actor FROM ircd_log_actors WHERE actor='?'") % nick); if(req.Send()) { insert = false; @@ -123,7 +121,7 @@ public: } else { - req = SQLreq(MyMod, SQLModule, dbid, "INSERT INTO ircd_log_actors (actor) VALUES('?')",nick); + req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("INSERT INTO ircd_log_actors (actor) VALUES('?')") % nick); if(req.Send()) { insert = true; @@ -137,7 +135,8 @@ public: if (res->Rows() && hostid == -1 && !insert) { hostid = atoi(res->GetValue(0,0).d.c_str()); - req = SQLreq(MyMod, SQLModule, dbid, "INSERT INTO ircd_log (category_id,nick,host,source,dtime) VALUES('?','?','?','?','?')", category, nickid, hostid , sourceid, date); + req = SQLrequest(MyMod, SQLModule, dbid, + SQLquery("INSERT INTO ircd_log (category_id,nick,host,source,dtime) VALUES('?','?','?','?','?')") % category % nickid % hostid % sourceid % date); if(req.Send()) { insert = true; @@ -147,7 +146,7 @@ public: } else if (res->Rows() && hostid == -1 && insert) { - req = SQLreq(MyMod, SQLModule, dbid, "SELECT id,hostname FROM ircd_log_hosts WHERE hostname='?'", hostname); + req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("SELECT id,hostname FROM ircd_log_hosts WHERE hostname='?'") % hostname); if(req.Send()) { insert = false; @@ -157,7 +156,7 @@ public: } else { - req = SQLreq(MyMod, SQLModule, dbid, "INSERT INTO ircd_log_hosts (hostname) VALUES('?')", hostname); + req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("INSERT INTO ircd_log_hosts (hostname) VALUES('?')") % hostname); if(req.Send()) { insert = true; @@ -256,7 +255,7 @@ class ModuleSQLLog : public Module if (!SQLModule) return; - SQLrequest req = SQLreq(this, SQLModule, dbid, "SELECT id,actor FROM ircd_log_actors WHERE actor='?'", source); + SQLrequest req = SQLrequest(this, SQLModule, dbid, SQLquery("SELECT id,actor FROM ircd_log_actors WHERE actor='?'") % source); if(req.Send()) { QueryInfo* i = new QueryInfo(nick, source, host, req.id, category); diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index c9149322c..2bfedc911 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -24,7 +24,6 @@ /* $ModDesc: Allows storage of oper credentials in an SQL table */ /* $ModDep: m_sqlv2.h m_sqlutils.h */ -/* $CompileFlags: -Wno-variadic-macros */ class ModuleSQLOper : public Module { @@ -105,7 +104,8 @@ public: * also hashing it in the module and only passing a remote query containing a hash is more secure. */ - SQLrequest req = SQLreq(this, target, databaseid, "SELECT username, password, hostname, type FROM ircd_opers WHERE username = '?' AND password='?'", username, md5_pass_hash); + SQLrequest req = SQLrequest(this, target, databaseid, + SQLquery("SELECT username, password, hostname, type FROM ircd_opers WHERE username = '?' AND password='?'") % username % md5_pass_hash); if (req.Send()) { diff --git a/src/modules/extra/m_sqlutils.cpp b/src/modules/extra/m_sqlutils.cpp index 1a5b5c1c0..07cecc698 100644 --- a/src/modules/extra/m_sqlutils.cpp +++ b/src/modules/extra/m_sqlutils.cpp @@ -22,7 +22,6 @@ /* $ModDesc: Provides some utilities to SQL client modules, such as mapping queries to users and channels */ /* $ModDep: m_sqlutils.h */ -/* $CompileFlags: -Wno-variadic-macros */ typedef std::map<unsigned long, User*> IdUserMap; typedef std::map<unsigned long, Channel*> IdChanMap; diff --git a/src/modules/extra/m_sqlv2.h b/src/modules/extra/m_sqlv2.h index c7f6edbb9..2279e9d54 100644 --- a/src/modules/extra/m_sqlv2.h +++ b/src/modules/extra/m_sqlv2.h @@ -19,12 +19,6 @@ #include <map> #include "modules.h" -/** SQLreq define. - * This is the voodoo magic which lets us pass multiple - * parameters to the SQLrequest constructor... voodoo... - */ -#define SQLreq(a, b, c, d, e...) SQLrequest(a, b, c, (SQLquery(d), ##e)) - /** Identifiers used to identify Request types */ #define SQLREQID "SQLv2 Request" @@ -140,11 +134,11 @@ public: * the workaround for this isn't easy to describe simply, but in a nutshell what's really * happening when - from the above example - you do this: * - * SQLrequest foo = SQLreq(this, target, "databaseid", "SELECT (foo, bar) FROM rawr WHERE foo = '?' AND bar = ?", "Hello", "42"); + * SQLrequest foo = SQLrequest(this, target, "databaseid", SQLquery("SELECT (foo, bar) FROM rawr WHERE foo = '?' AND bar = ?", "Hello", "42")); * * what's actually happening is functionally this: * - * SQLrequest foo = SQLreq(this, target, "databaseid", query("SELECT (foo, bar) FROM rawr WHERE foo = '?' AND bar = ?").addparam("Hello").addparam("42")); + * SQLrequest foo = SQLrequest(this, target, "databaseid", query("SELECT (foo, bar) FROM rawr WHERE foo = '?' AND bar = ?").addparam("Hello").addparam("42")); * * with 'query()' returning a reference to an object with a 'addparam()' member function which * in turn returns a reference to that object. There are actually four ways you can create a @@ -233,7 +227,7 @@ public: /** Initialize an SQLrequest. * For example: * - * SQLrequest req = SQLreq(MyMod, SQLModule, dbid, "INSERT INTO ircd_log_actors VALUES('','?')", nick); + * SQLrequest req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("INSERT INTO ircd_log_actors VALUES('','?')" % nick)); * * @param s A pointer to the sending module, where the result should be routed * @param d A pointer to the receiving module, identified as implementing the 'SQL' feature diff --git a/src/modules/extra/m_testclient.cpp b/src/modules/extra/m_testclient.cpp index eb911bf49..e7c7c35bc 100644 --- a/src/modules/extra/m_testclient.cpp +++ b/src/modules/extra/m_testclient.cpp @@ -18,8 +18,6 @@ #include "configreader.h" #include "m_sqlv2.h" -/* $CompileFlags: -Wno-variadic-macros */ - class ModuleTestClient : public Module { private: @@ -47,7 +45,8 @@ public: if(target) { - SQLrequest foo = SQLreq(this, target, "foo", "UPDATE rawr SET foo = '?' WHERE bar = 42", ConvToStr(time(NULL))); + SQLrequest foo = SQLrequest(this, target, "foo", + SQLquery("UPDATE rawr SET foo = '?' WHERE bar = 42") % time(NULL)); if(foo.Send()) { |