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:
commit
f8d5db9edf
@ -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) {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user