mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Fix to support node@4 LTS
This commit is contained in:
parent
a720dc774b
commit
3675d2b041
2
index.js
2
index.js
@ -114,7 +114,7 @@ Cursor.prototype.handleError = function(msg) {
|
||||
this._queue.pop()[1](msg)
|
||||
}
|
||||
|
||||
if (this.eventNames().indexOf('error') >= 0) {
|
||||
if (this.listenerCount('error') > 0) {
|
||||
//only dispatch error events if we have a listener
|
||||
this.emit('error', msg)
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha test"
|
||||
"test": "mocha"
|
||||
},
|
||||
"author": "Brian M. Carlson",
|
||||
"license": "MIT",
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
var assert = require('assert')
|
||||
var Cursor = require('../')
|
||||
var pg = require('pg')
|
||||
@ -70,7 +71,7 @@ describe('proper cleanup', function () {
|
||||
cursor1.read(8, function (err, rows) {
|
||||
assert.ifError(err)
|
||||
assert.equal(rows.length, 5)
|
||||
cursor2 = client.query(new Cursor(text))
|
||||
var cursor2 = client.query(new Cursor(text))
|
||||
cursor2.read(8, function (err, rows) {
|
||||
assert.ifError(err)
|
||||
assert.equal(rows.length, 5)
|
||||
|
||||
@ -30,7 +30,6 @@ describe('cursor', function() {
|
||||
})
|
||||
})
|
||||
|
||||
for (var i = 0; i < 100; i++)
|
||||
it('end before reading to end', function(done) {
|
||||
var cursor = this.pgCursor(text)
|
||||
cursor.read(3, function(err, res) {
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
--reporter spec
|
||||
--no-exit
|
||||
--bail
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
const assert = require('assert')
|
||||
const Cursor = require('../')
|
||||
const pg = require('pg')
|
||||
@ -82,4 +83,4 @@ describe('pool', function() {
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
9
test/result-config.js
Normal file
9
test/result-config.js
Normal file
@ -0,0 +1,9 @@
|
||||
var assert = require('assert')
|
||||
var Cursor = require('../')
|
||||
var pg = require('pg')
|
||||
|
||||
describe('Custom query config', () => {
|
||||
it('supports row mode array', () => {
|
||||
|
||||
})
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user