node-pg-query-stream icon indicating copy to clipboard operation
node-pg-query-stream copied to clipboard

Can you combine QueryStream & Prepared Statements?

Open if-kenn opened this issue 8 years ago • 4 comments

Is this possible?

When I do something like:

var pg          = require('pg'),
    QueryStream = require('pg-query-stream');
    credUrl     = {...};

pg.connect(credUrl, function(err, client, done) {
    var query       = new QueryStream({text : 'SELECT 10 as ten;', name : 'select10'}, []),
        stream      = client.query(query);
});

I get "TypeError: Argument must be a string". Am I missing something?

if-kenn avatar Mar 19 '16 00:03 if-kenn

I would suggest you to try:

var query = new QueryStream('SELECT 10 as ten', []);
qyery.name = 'select10';

I have not tried it yet myself. But by idea it should work.

btd avatar Mar 22 '16 15:03 btd

Any (official) update on this?

Now with [email protected] this becomes really important

goloroden avatar Jul 11 '17 08:07 goloroden

This isn't currently supported but I can add it as a new feature.

If you or your company benefit from node-postgres and have the means, please consider supporting my work on Patreon.

brianc avatar Aug 06 '17 17:08 brianc

This would be really great 😊

goloroden avatar Aug 06 '17 21:08 goloroden