Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

native library does not give result on query.on("end",...) #219

Closed
maralorn opened this Issue Nov 16, 2012 · 1 comment

Comments

3 participants

Hey, I wrote some code like this (in coffeescript, I hope that's ok)

cb = (row, result) ->
    result.addRow(row)

request = client.query config
request.on "row", cb
request.on "end", console.log

(Of course i had defined a correct config object and client comes out of pg.connect)
This works for me with

pg = require("pg")

but with

pg = require("pg").native

it just prints undefined.

I don't think that this is supposed to happen...

"version": "0.8.4"

Tharabas commented Dec 7, 2012

I can confirm this when running Postgres 9.2.1 on Mac (10.7.5)

query = client.query queryString, params

query.on 'row', (row, result) -> 
  # within the row event result is available
  result.addRow row

query.on 'end', (result) ->
  # now here result is undefined
  console.log "Modified #{result.rowCount} rows"

Without the .native library call pg runs like a charm,
but when I switch to it, the result is simply missing in the end

@brianc brianc closed this in 102a069 Dec 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment