From 903e9b25ea76354fc7fc41f54d44cd0124f796d4 Mon Sep 17 00:00:00 2001 From: Stephen Sugden Date: Mon, 10 Dec 2012 22:50:29 -0800 Subject: [PATCH] Attach Query constructors to Client constructors --- lib/client.js | 3 +++ lib/index.js | 2 +- lib/native/index.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index c861daf..eb04e6b 100644 --- a/lib/client.js +++ b/lib/client.js @@ -218,4 +218,7 @@ Client.md5 = function(string) { return crypto.createHash('md5').update(string).digest('hex'); }; +// expose a Query constructor +Client.Query = Query; + module.exports = Client; diff --git a/lib/index.js b/lib/index.js index da27c49..9dcf7c1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -13,7 +13,7 @@ var PG = function(clientConstructor) { EventEmitter.call(this); this.Client = clientConstructor; this.Connection = require(__dirname + '/connection'); - this.Query = require(__dirname + '/query'); + this.Query = clientConstructor.Query this.defaults = defaults; }; diff --git a/lib/native/index.js b/lib/native/index.js index ae7fd0a..8fc5adf 100644 --- a/lib/native/index.js +++ b/lib/native/index.js @@ -171,4 +171,7 @@ var clientBuilder = function(config) { return connection; }; +// expose a Query constructor +clientBuilder.Query = NativeQuery; + module.exports = clientBuilder;