mysql-promise
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -20,2 +20,10 @@ 'use strict'; | ||
/** | ||
* Check if a pool has been configured for this instane. | ||
* @return {Boolean} | ||
*/ | ||
DB.prototype.isConfigured = function () { | ||
return !!this.pool; | ||
}; | ||
/** | ||
* Run DB query | ||
@@ -22,0 +30,0 @@ * @param {String} query |
{ | ||
"name": "mysql-promise", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Small wrapper for mysql that use promises.", | ||
@@ -29,4 +29,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"bluebird": "^2.1.3", | ||
"mysql": "^2.3.2" | ||
"bluebird": "^2.10.2", | ||
"mysql": "^2.10.2" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
# mysql-promise | ||
Small wrapper for mysql that use promises. | ||
Small wrapper for [mysql](https://www.npmjs.com/package/mysql) that use promises. | ||
@@ -36,8 +36,11 @@ [![build status](https://secure.travis-ci.org/martinj/node-mysql-promise.png)](http://travis-ci.org/martinj/node-mysql-promise) | ||
db2.configure({ | ||
"host": "localhost", | ||
"user": "foo", | ||
"password": "bar", | ||
"database": "another-db" | ||
}); | ||
//check if has already been configured | ||
if (!db2.isConfigured()) { | ||
db2.configure({ | ||
"host": "localhost", | ||
"user": "foo", | ||
"password": "bar", | ||
"database": "another-db" | ||
}); | ||
} | ||
@@ -44,0 +47,0 @@ db2.query('SELECT * FROM users').spread(function (users) { |
@@ -13,2 +13,23 @@ 'use strict'; | ||
}); | ||
}); | ||
describe('isConfigured()', function () { | ||
it('should return false if it has no pool configured', function () { | ||
var defaultDb = db(); | ||
defaultDb.isConfigured().should.be.false; | ||
}); | ||
it('should return false if it has no pool configured', function () { | ||
var defaultDb = db(); | ||
defaultDb.configure({ | ||
host: "localhost", | ||
user: "foo", | ||
password: "bar", | ||
database: "db" | ||
}) | ||
defaultDb.isConfigured().should.be.true; | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
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
5188
8
99
51
Updatedbluebird@^2.10.2
Updatedmysql@^2.10.2