Skip to content

Commit 71dde04

Browse files
committed
Merge branch 'master' of github.com:brianc/node-pg-cursor
2 parents 1200da5 + 67b880a commit 71dde04

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ Cursor.prototype._sendRows = function () {
9494
})
9595
}
9696

97-
Cursor.prototype.handleCommandComplete = function () {
97+
Cursor.prototype.handleCommandComplete = function (msg) {
98+
this._result.addCommandComplete(msg)
9899
this.connection.sync()
99100
}
100101

test/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,18 @@ describe('cursor', function () {
160160
done()
161161
})
162162
})
163+
164+
it('returns rowCount on insert', function (done) {
165+
var pgCursor = this.pgCursor
166+
this.client.query('CREATE TEMPORARY TABLE pg_cursor_test (foo VARCHAR(1), bar VARCHAR(1))')
167+
.then(function () {
168+
var cursor = pgCursor('insert into pg_cursor_test values($1, $2)', ['a', 'b'])
169+
cursor.read(1, function (err, rows, result) {
170+
assert.ifError(err)
171+
assert.equal(rows.length, 0)
172+
assert.equal(result.rowCount, 1)
173+
done()
174+
})
175+
}).catch(done)
176+
})
163177
})

0 commit comments

Comments
 (0)