brianc/node-postgres — pull request #228 by grncdr (2012-12-10 04:12:26+00:00)
Title: Premade query object

Over on #227 Brian said:

> If you need contributions on anything in particular I'd love to help you out.

This change would make it possible for any-db to remove the adapter layer for postgres and expose (patched) Client objects directly. The change is motivated by the way [ConnectionPool.query](https://github.com/grncdr/node-any-db/blob/master/lib/connection-pool.js#L55) works. The pool is able to return a `QueryAdapter` synchronously because `connection.query` accepts it as an optional parameter.

In this patch I've added support to the pure-js driver for separating initialization and construction in `Query` objects, which enables [Client.query](https://github.com/brianc/node-postgres/blob/master/lib/client.js#L187)) to use a `query_object` from the config. If the general idea makes sense to you I'll try and do the same for the NativeQuery object.