diff --git a/README.md b/README.md index 280f9d5..83bd9da 100644 --- a/README.md +++ b/README.md @@ -134,5 +134,8 @@ The options used to create a pool cluster. See [mysqljs/mysql documentation](htt `poolCluster.on`: Add a listener to the pool cluster object. See [mysqljs/mysql documentation](https://github.com/mysqljs/mysql#poolcluster) for events that may be listened for. -## Upgrading from v3 +## Upgrading from v3 to v4 The main difference is that `mysql.createPool` now returns a promise. Besides this, the API is the same and you should be able to upgrade straight to v4. The only other difference is the extra options in the [connectionOptions object](#connectionoptions-object). + +## Upgrading from v4 to v5 +The `pool.releaseConnection` has been removed, please use `poolConnection.release` instead. diff --git a/lib/pool.js b/lib/pool.js index bbd3e81..3350963 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -53,11 +53,6 @@ class pool { }); } - releaseConnection(connection) { - //Use the underlying connection from the mysql-module here: - return this.pool.releaseConnection(connection.connection); - } - query() { return promiseCallback.apply(this.pool, ['query', arguments, this.returnArgumentsArray]); } diff --git a/package-lock.json b/package-lock.json index 6f8c93a..7cb5278 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "promise-mysql", - "version": "4.1.4", + "version": "5.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 08490a6..0891d53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "promise-mysql", - "version": "4.1.4", + "version": "5.0.0", "description": "A bluebird wrapper for node-mysql", "main": "index.js", "scripts": { diff --git a/test/pool.js b/test/pool.js index 41c00a7..77f9f5f 100644 --- a/test/pool.js +++ b/test/pool.js @@ -11,7 +11,6 @@ sinon.addBehavior(`callsLastArgWith`, (fake, errVal, retVal) => { const poolMock = { getConnection: sinon.stub().callsLastArgWith(null, `getConnectionPromise`).returns(`getConnectionReturn`), - releaseConnection: sinon.stub().returns(`releaseConnectionReturn`), query: sinon.stub().callsLastArgWith(null, `queryPromise`).returns(`queryReturn`), end: sinon.stub().callsLastArgWith(null, `endPromise`).returns(`endReturn`), escape: sinon.stub().returnsArg(0), @@ -36,7 +35,6 @@ const pool = proxyquire(`../lib/pool.js`, { tap.beforeEach((done) => { createPool.resetHistory(); poolMock.getConnection.resetHistory(); - poolMock.releaseConnection.resetHistory(); poolMock.query.resetHistory(); poolMock.end.resetHistory(); poolMock.escape.resetHistory(); @@ -230,30 +228,6 @@ tap.test(`calls the underlying methods`, (t) => { }); }); - t.test(`pool.releaseConnection should call the underlying releaseConnection method with the correct arguments`, (t) => { - const connection = { - connection: 'test' - } - - const retVal = pool.releaseConnection(connection) - - t.ok(poolMock.releaseConnection.calledOnce, `underlying releaseConnection method called`) - t.equal( - poolMock.releaseConnection.lastCall.args.length, - 1, - `underlying releaseConnection called with correct number of arguments` - ); - t.ok(poolMock.releaseConnection.calledWith(connection.connection)); - - t.same( - retVal, - `releaseConnectionReturn`, - `returns arguments` - ); - - t.end(); - }); - t.end(); }); })