Comparing version 0.1.5 to 0.1.6
@@ -25,11 +25,14 @@ var nodefn = require('when/node/function'); | ||
create: function(callback) { | ||
var conn = instance.getRawConnection(); | ||
conn.__cid = _.uniqueId('__cid'); | ||
if (this.beforeCreate) { | ||
this.beforeCreate(conn, function() { | ||
var pool = this; | ||
instance.getRawConnection(function(err, conn) { | ||
if (err) return callback(err); | ||
conn.__cid = _.uniqueId('__cid'); | ||
if (pool.afterCreate) { | ||
pool.afterCreate(conn, function(err) { | ||
callback(err, conn); | ||
}); | ||
} else { | ||
callback(null, conn); | ||
}); | ||
} else { | ||
callback(null, conn); | ||
} | ||
} | ||
}); | ||
}, | ||
@@ -36,0 +39,0 @@ destroy: function(conn) { |
@@ -64,6 +64,7 @@ var When = require('when'); | ||
getRawConnection: function() { | ||
getRawConnection: function(callback) { | ||
var conn = mysql.createConnection(this.connectionSettings); | ||
conn.connect(); | ||
return conn; | ||
conn.connect(function(err) { | ||
callback(err, conn); | ||
}); | ||
} | ||
@@ -70,0 +71,0 @@ |
@@ -72,6 +72,7 @@ var When = require('when'); | ||
// Returns a connection from the `pg` lib. | ||
getRawConnection: function() { | ||
getRawConnection: function(callback) { | ||
var conn = new pg.Client(this.connectionSettings); | ||
conn.connect(); | ||
return conn; | ||
conn.connect(function(err) { | ||
callback(err, conn); | ||
}); | ||
} | ||
@@ -78,0 +79,0 @@ |
@@ -74,4 +74,6 @@ var When = require('when'); | ||
getRawConnection: function() { | ||
return new sqlite3.Database(this.connectionSettings.filename); | ||
getRawConnection: function(callback) { | ||
var client = new sqlite3.Database(this.connectionSettings.filename, function(err) { | ||
callback(err, client); | ||
}); | ||
}, | ||
@@ -78,0 +80,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Knex.js 0.1.5 | ||
// Knex.js 0.1.6 | ||
// | ||
@@ -26,3 +26,3 @@ // (c) 2013 Tim Griesser | ||
// Keep in sync with package.json | ||
Knex.VERSION = '0.1.5'; | ||
Knex.VERSION = '0.1.6'; | ||
@@ -29,0 +29,0 @@ // Methods common to both the `Grammar` and `SchemaGrammar` interfaces, |
{ | ||
"name": "knex", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "A query builder for Postgres, MySQL and SQLite3, designed to be flexible, portable, and fun to use.", | ||
@@ -5,0 +5,0 @@ "main": "knex.js", |
@@ -11,3 +11,3 @@ var equal = require('assert').equal; | ||
var pool = { | ||
beforeCreate: function(conn, done) { | ||
afterCreate: function(conn, done) { | ||
equal(_.has(conn, '__cid'), true); | ||
@@ -14,0 +14,0 @@ done(); |
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
197355
5974