From c126ba1c7c95a3e8b466710fae1807f9fba6e470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20H=C3=B6rl?= Date: Wed, 26 Jun 2013 22:32:07 +0200 Subject: [PATCH] Added NODE_PG_FORCE_NATIVE to force usage of libpg bindings (native client) --- lib/index.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/index.js b/lib/index.js index bb2041b..6bd6838 100644 --- a/lib/index.js +++ b/lib/index.js @@ -52,12 +52,15 @@ PG.prototype.cancel = function(config, client, query) { cancellingClient.cancel(client, query); }; -module.exports = new PG(Client); - -//lazy require native module...the native module may not have installed -module.exports.__defineGetter__("native", function() { - delete module.exports.native; - module.exports.native = new PG(require(__dirname + '/native')); - return module.exports.native; -}); +if (process.env.hasOwnProperty('NODE_PG_FORCE_NATIVE')) { + module.exports = new PG(require(__dirname + '/native')); +} else { + module.exports = new PG(Client); + //lazy require native module...the native module may not have installed + module.exports.__defineGetter__("native", function() { + delete module.exports.native; + module.exports.native = new PG(require(__dirname + '/native')); + return module.exports.native; + }); +}