KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Having trouble getting results back from SELECT queries in node-postgres. Now rows are empty at the end of the codeblock. This select just returns a next value from a sequence in POSTGRESQL. I know that you can not retrieve results from callback, but are there anyone here who have used node-postgres(or any other database modules to node) that might know a fix? client.connect(); var query = client.query("SELECT nextval(\'idgenerator\');"); var rows = []; query.on('row', function(row, res) { rows.push(row); }); query.on('end', function(result) { console.log(result.rowCount + ' rows were received'); }); //client.end(); console.log(rows);
Tags (comma-separated)
Save Edits
Cancel