Comparing version 1.2.0 to 1.2.1
@@ -20,2 +20,3 @@ var PQ = module.exports = require('bindings')('addon.node').PQ; | ||
PQ.prototype.connectSync = function(paramString) { | ||
this.connected = true; | ||
if(!paramString) { | ||
@@ -34,2 +35,3 @@ paramString = ''; | ||
PQ.prototype.connect = function(paramString, cb) { | ||
this.connected = true; | ||
if(typeof paramString == 'function') { | ||
@@ -60,2 +62,3 @@ cb = paramString; | ||
PQ.prototype.finish = function() { | ||
this.connected = false; | ||
this.$finish(); | ||
@@ -252,2 +255,3 @@ }; | ||
PQ.prototype.startReader = function() { | ||
assert(this.connected, 'Must be connected to start reader'); | ||
this.$startRead(); | ||
@@ -262,2 +266,3 @@ }; | ||
PQ.prototype.writable = function(cb) { | ||
assert(this.connected, 'Must be connected to start writer'); | ||
this.$startWrite(); | ||
@@ -264,0 +269,0 @@ return this.once('writable', cb); |
{ | ||
"name": "libpq", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Low-level native bindings to PostgreSQL libpq", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,5 +8,7 @@ var PQ = require('../') | ||
var pq = new PQ(); | ||
assert(!pq.connected, 'should have connected set to falsy'); | ||
pq.connect(function(err) { | ||
assert.ifError(err); | ||
pq.exec('SELECT NOW()'); | ||
assert.equal(pq.connected, true, 'should have connected set to true'); | ||
assert.equal(pq.ntuples(), 1); | ||
@@ -13,0 +15,0 @@ done(); |
@@ -19,2 +19,17 @@ var PQ = require('../') | ||
}); | ||
it('throws when reading while not connected', function() { | ||
var pq = new PQ(); | ||
assert.throws(function() { | ||
pq.startReader(); | ||
}); | ||
}); | ||
it('throws when writing while not connected', function() { | ||
var pq = new PQ(); | ||
assert.throws(function() { | ||
pq.writable(function() { | ||
}); | ||
}); | ||
}); | ||
}) |
@@ -21,4 +21,9 @@ var PQ = require('../') | ||
it('is connected', function() { | ||
assert(this.pq.connected, 'should have connected == true'); | ||
}); | ||
after(function() { | ||
this.pq.finish(); | ||
assert(!this.pq.connected); | ||
}); | ||
@@ -25,0 +30,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80345
978