aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/extra/m_pgsql.cpp
diff options
context:
space:
mode:
authorGravatar Attila Molnar2016-09-16 10:54:15 +0200
committerGravatar GitHub2016-09-16 10:54:15 +0200
commitbdfde49fb6d9a8787c072b759d4af27584308e1b (patch)
tree0d79854e65b0de68fd2f85f9a0f8f6f06e6b4aed /src/modules/extra/m_pgsql.cpp
parentMerge pull request #1176 from SaberUK/master+format (diff)
parentRewrite the build system directive parser. (diff)
downloadinspircd++-bdfde49fb6d9a8787c072b759d4af27584308e1b.tar.gz
inspircd++-bdfde49fb6d9a8787c072b759d4af27584308e1b.tar.bz2
inspircd++-bdfde49fb6d9a8787c072b759d4af27584308e1b.zip
Merge pull request #1219 from SaberUK/master+directive
Rewrite the build system directive parser.
Diffstat (limited to 'src/modules/extra/m_pgsql.cpp')
-rw-r--r--src/modules/extra/m_pgsql.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index ff8c1174c..56455a718 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -21,15 +21,18 @@
* 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("darwin") postgresql
+/// $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
@@ -412,14 +415,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);
}
}
@@ -447,14 +446,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);
}
}