Merge pull request #734 from MayhemYDG/patch

Fix result.rowCount being a string instead of a number via native bindings.
This commit is contained in:
Brian C 2015-02-22 16:33:29 -04:00
commit f8d5db9edf
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.strictEqual(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');