Merge branch 'master' of github.com:brianc/node-pg-cursor

This commit is contained in:
Brian M. Carlson 2019-01-08 08:52:25 -06:00
commit 71dde045ea
2 changed files with 16 additions and 1 deletions

View File

@ -94,7 +94,8 @@ Cursor.prototype._sendRows = function () {
})
}
Cursor.prototype.handleCommandComplete = function () {
Cursor.prototype.handleCommandComplete = function (msg) {
this._result.addCommandComplete(msg)
this.connection.sync()
}

View File

@ -160,4 +160,18 @@ describe('cursor', function () {
done()
})
})
it('returns rowCount on insert', function (done) {
var pgCursor = this.pgCursor
this.client.query('CREATE TEMPORARY TABLE pg_cursor_test (foo VARCHAR(1), bar VARCHAR(1))')
.then(function () {
var cursor = pgCursor('insert into pg_cursor_test values($1, $2)', ['a', 'b'])
cursor.read(1, function (err, rows, result) {
assert.ifError(err)
assert.equal(rows.length, 0)
assert.equal(result.rowCount, 1)
done()
})
}).catch(done)
})
})