summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_pgsql.cpp
diff options
context:
space:
mode:
authorGravatar om2006-07-21 11:42:55 +0000
committerGravatar om2006-07-21 11:42:55 +0000
commit95ac8e2fd305798bdaa6d0e1720fb36e3f954b18 (patch)
tree9fbf87e6a7ea0c36689865ad3ebf7548e30139c1 /src/modules/extra/m_pgsql.cpp
parentAPI header and client module updates for new multi-parameter query request. N... (diff)
Add tiny perl script to detect version and pass an appropriate -D to gcc. Make m_pgsql #ifdef around PQescapeStringConn() which is only available in PostgreSQL >= 8.1.4
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4472 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra/m_pgsql.cpp')
-rw-r--r--src/modules/extra/m_pgsql.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 39849271d..c7feb2a22 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -31,7 +31,7 @@
#include "m_sqlv2.h"
/* $ModDesc: PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API */
-/* $CompileFlags: -I`pg_config --includedir` */
+/* $CompileFlags: -I`pg_config --includedir` `perl extra/pgsql_config.pl` */
/* $LinkerFlags: -L`pg_config --libdir` -lpq */
/* UGH, UGH, UGH, UGH, UGH, UGH
@@ -956,8 +956,13 @@ SQLerror SQLConn::DoQuery(const SQLrequest &req)
char* query = new char[(req.query.q.length()*2)+1];
int error = 0;
-
- // PQescapeStringConn(sql, query, req.query.q.c_str(), req.query.q.length(), error);
+
+#ifdef PGSQL_HAS_ESCAPECONN
+ PQescapeStringConn(sql, query, req.query.q.c_str(), req.query.q.length(), &error);
+#else
+ PQescapeString(query, req.query.q.c_str(), req.query.q.length());
+ error = 0;
+#endif
if(error == 0)
{