Skip to content

Commit 37956e2

Browse files
committed
Fix result.rowCount being a string instead of a number via native bindings.
Fixes brianc#708
1 parent 8c10612 commit 37956e2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/native/result.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var NativeResult = module.exports = function(pq) {
77

88
NativeResult.prototype.addCommandComplete = function(pq) {
99
this.command = pq.cmdStatus().split(' ')[0];
10-
this.rowCount = pq.cmdTuples();
10+
this.rowCount = parseInt(pq.cmdTuples(), 10);
1111
var nfields = pq.nfields();
1212
if(nfields < 1) return;
1313

@@ -19,4 +19,3 @@ NativeResult.prototype.addCommandComplete = function(pq) {
1919
});
2020
}
2121
};
22-

test/native/callback-api-tests.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test('fires callback with results', function() {
88
client.query('SELECT 1 as num', assert.calls(function(err, result) {
99
assert.isNull(err);
1010
assert.equal(result.rows[0].num, 1);
11+
assert.equal(result.rowCount, 1);
1112
client.query('SELECT * FROM person WHERE name = $1', ['Brian'], assert.calls(function(err, result) {
1213
assert.isNull(err);
1314
assert.equal(result.rows[0].name, 'Brian');

0 commit comments

Comments
 (0)