Fix result.rowCount being a string instead of a number via native bindings.

Fixes #708
This commit is contained in:
Mayhem 2015-02-21 17:32:39 +01:00
parent 8c10612668
commit 37956e22c5
2 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ var NativeResult = module.exports = function(pq) {
NativeResult.prototype.addCommandComplete = function(pq) {
this.command = pq.cmdStatus().split(' ')[0];
this.rowCount = pq.cmdTuples();
this.rowCount = parseInt(pq.cmdTuples(), 10);
var nfields = pq.nfields();
if(nfields < 1) return;
@ -19,4 +19,3 @@ NativeResult.prototype.addCommandComplete = function(pq) {
});
}
};

View File

@ -8,6 +8,7 @@ test('fires callback with results', function() {
client.query('SELECT 1 as num', assert.calls(function(err, result) {
assert.isNull(err);
assert.equal(result.rows[0].num, 1);
assert.equal(result.rowCount, 1);
client.query('SELECT * FROM person WHERE name = $1', ['Brian'], assert.calls(function(err, result) {
assert.isNull(err);
assert.equal(result.rows[0].name, 'Brian');