Take the tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I would like to know how can you check the row count of the query in PostgreSQL in node.js I have this code for the meantime.

    var client = new pg.Client(conString);
    client.connect();
    var query = client.query("SELECT * FROM users"); 
    query.on('row', function(row) {
      console.log(row);
    }); 
share|improve this question
 
thanks for editing Milen –  Jude Calimbas Feb 28 '12 at 7:33
add comment

1 Answer

up vote 1 down vote accepted
var client = new pg.Client(conString);

client.connect();

client.query("SELECT * FROM users", function(err, result) {
    console.log("Row count: %d",result.rows.length);  // n
});
share|improve this answer
 
thanks raynos. this is what iv been looking for –  Jude Calimbas Feb 28 '12 at 7:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.