forked from brianc/node-postgres
-
Notifications
You must be signed in to change notification settings - Fork 0
Query
brianc edited this page Nov 5, 2010
·
13 revisions
Not to be created directly from its constructor, the Query is returned from Client#connect. It functions primarily as an EventEmitter allowing you to handle returned rows.
I'm still working on the API for prepared statements. Check out the tests for more up to date examples, but what I'm working towards is something like this:
var client = new Client({
user: 'brian',
database: 'test'
});
var query = client.query({
text: 'select * from person where age < $1',
values: [21]
});
query.on('row', function(row) {
console.log(row);
});
query.on('end', function() { client.end() });