1
+ #include < pg_config.h>
1
2
#include < libpq-fe.h>
2
3
#include < node.h>
3
4
#include < node_buffer.h>
8
9
#define LOG (msg ) printf(" %s\n " ,msg);
9
10
#define TRACE (msg ) // printf("%s\n", msg);
10
11
12
+ #if PG_VERSION_NUM >= 90000
13
+ #define ESCAPE_SUPPORTED
14
+ #endif
11
15
12
16
#define THROW (msg ) return ThrowException(Exception::Error(String::New(msg)));
13
17
@@ -67,8 +71,10 @@ class Connection : public ObjectWrap {
67
71
command_symbol = NODE_PSYMBOL (" command" );
68
72
69
73
NODE_SET_PROTOTYPE_METHOD (t, " connect" , Connect);
74
+ #ifdef ESCAPE_SUPPORTED
70
75
NODE_SET_PROTOTYPE_METHOD (t, " escapeIdentifier" , EscapeIdentifier);
71
76
NODE_SET_PROTOTYPE_METHOD (t, " escapeLiteral" , EscapeLiteral);
77
+ #endif
72
78
NODE_SET_PROTOTYPE_METHOD (t, " _sendQuery" , SendQuery);
73
79
NODE_SET_PROTOTYPE_METHOD (t, " _sendQueryWithParams" , SendQueryWithParams);
74
80
NODE_SET_PROTOTYPE_METHOD (t, " _sendPrepare" , SendPrepare);
@@ -132,6 +138,7 @@ class Connection : public ObjectWrap {
132
138
return Undefined ();
133
139
}
134
140
141
+ #ifdef ESCAPE_SUPPORTED
135
142
// v8 entry point into Connection#escapeIdentifier
136
143
static Handle <Value>
137
144
EscapeIdentifier (const Arguments& args)
@@ -183,6 +190,7 @@ class Connection : public ObjectWrap {
183
190
184
191
return scope.Close (jsStr);
185
192
}
193
+ #endif
186
194
187
195
// v8 entry point into Connection#_sendQuery
188
196
static Handle <Value>
@@ -361,6 +369,7 @@ class Connection : public ObjectWrap {
361
369
return args.This ();
362
370
}
363
371
372
+ #ifdef ESCAPE_SUPPORTED
364
373
char * EscapeIdentifier (const char *str)
365
374
{
366
375
TRACE (" js::EscapeIdentifier" )
@@ -372,6 +381,7 @@ class Connection : public ObjectWrap {
372
381
TRACE (" js::EscapeLiteral" )
373
382
return PQescapeLiteral (connection_, str, strlen (str));
374
383
}
384
+ #endif
375
385
376
386
int Send (const char *queryText)
377
387
{
0 commit comments