]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_pgsql.cpp
Add PackageInfo directives for Debian.
[user/henk/code/inspircd.git] / src / modules / extra / m_pgsql.cpp
index ff8c1174c8e72937a93c6f800d5b4c7d6beabee3..09aba7de9fef96af570b3bd8ab6903a7d85d3274 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+/// $CompilerFlags: -Iexecute("pg_config --includedir" "POSTGRESQL_INCLUDE_DIR")
+/// $LinkerFlags: -Lexecute("pg_config --libdir" "POSTGRESQL_LIBRARY_DIR") -lpq
+
+/// $PackageInfo: require_system("centos") postgresql-devel
+/// $PackageInfo: require_system("darwin") postgresql
+/// $PackageInfo: require_system("debian") libpq-dev
+/// $PackageInfo: require_system("ubuntu") libpq-dev
+
 
 #include "inspircd.h"
 #include <cstdlib>
 #include <libpq-fe.h>
 #include "modules/sql.h"
 
-/* $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 */
-
 /* SQLConn rewritten by peavey to
  * use EventHandler instead of
  * BufferedSocket. This is much neater
@@ -155,7 +160,7 @@ class SQLConn : public SQLProvider, public EventHandler
                }
        }
 
-       CullResult cull()
+       CullResult cull() CXX11_OVERRIDE
        {
                this->SQLProvider::cull();
                ServerInstance->Modules->DelService(*this);
@@ -385,7 +390,7 @@ restart:
                }
        }
 
-       void submit(SQLQuery *req, const std::string& q)
+       void submit(SQLQuery *req, const std::string& q) CXX11_OVERRIDE
        {
                if (qinprog.q.empty())
                {
@@ -398,7 +403,7 @@ restart:
                }
        }
 
-       void submit(SQLQuery *req, const std::string& q, const ParamL& p)
+       void submit(SQLQuery *req, const std::string& q, const ParamL& p) CXX11_OVERRIDE
        {
                std::string res;
                unsigned int param = 0;
@@ -412,14 +417,10 @@ restart:
                                {
                                        std::string parm = p[param++];
                                        std::vector<char> buffer(parm.length() * 2 + 1);
-#ifdef PGSQL_HAS_ESCAPECONN
                                        int error;
                                        size_t escapedsize = PQescapeStringConn(sql, &buffer[0], parm.data(), parm.length(), &error);
                                        if (error)
                                                ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "BUG: Apparently PQescapeStringConn() failed");
-#else
-                                       size_t escapedsize = PQescapeString(&buffer[0], parm.data(), parm.length());
-#endif
                                        res.append(&buffer[0], escapedsize);
                                }
                        }
@@ -427,7 +428,7 @@ restart:
                submit(req, res);
        }
 
-       void submit(SQLQuery *req, const std::string& q, const ParamM& p)
+       void submit(SQLQuery *req, const std::string& q, const ParamM& p) CXX11_OVERRIDE
        {
                std::string res;
                for(std::string::size_type i = 0; i < q.length(); i++)
@@ -447,14 +448,10 @@ restart:
                                {
                                        std::string parm = it->second;
                                        std::vector<char> buffer(parm.length() * 2 + 1);
-#ifdef PGSQL_HAS_ESCAPECONN
                                        int error;
                                        size_t escapedsize = PQescapeStringConn(sql, &buffer[0], parm.data(), parm.length(), &error);
                                        if (error)
                                                ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "BUG: Apparently PQescapeStringConn() failed");
-#else
-                                       size_t escapedsize = PQescapeString(&buffer[0], parm.data(), parm.length());
-#endif
                                        res.append(&buffer[0], escapedsize);
                                }
                        }