Added NODE_PG_FORCE_NATIVE to force usage of libpg bindings (native client)

This commit is contained in:
Hannes Hörl 2013-06-26 22:32:07 +02:00
parent 690f224c11
commit c126ba1c7c

View File

@ -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;
});
}