不要怂,就是干,撸起袖子干!

Commit cf8cd6eb by Sascha Depold

Merge branch 'master' into features/transactions

Conflicts:
	lib/dialects/sqlite/query.js
2 parents 06b8b2bf 53007f22
......@@ -13,9 +13,9 @@ teaser:
test:
@if [ "$$GREP" ]; then \
make teaser && ./node_modules/mocha/bin/mocha --colors -t 10000 --reporter $(REPORTER) -g "$$GREP" $(TESTS); \
make teaser && ./node_modules/mocha/bin/mocha --check-leaks --colors -t 10000 --reporter $(REPORTER) -g "$$GREP" $(TESTS); \
else \
make teaser && ./node_modules/mocha/bin/mocha --colors -t 10000 --reporter $(REPORTER) $(TESTS); \
make teaser && ./node_modules/mocha/bin/mocha --check-leaks --colors -t 10000 --reporter $(REPORTER) $(TESTS); \
fi
......
......@@ -11,7 +11,9 @@ module.exports = (function() {
}
HasManyDoubleLinked.prototype.injectGetter = function(options) {
var self = this, _options = options
var self = this
, _options = options
, smart
var customEventEmitter = new Utils.CustomEventEmitter(function() {
var where = {}
......
......@@ -10,6 +10,7 @@ module.exports = (function() {
HasManySingleLinked.prototype.injectGetter = function(options) {
var self = this
, where = {}
, smart
options = options || {}
var primaryKey = Object.keys(this.instance.rawAttributes).filter(function(k) { return self.instance.rawAttributes[k].primaryKey === true })
......
......@@ -45,6 +45,7 @@ module.exports = (function() {
HasOne.prototype.injectGetter = function(obj) {
var self = this
, smart
obj[this.accessors.get] = function(params) {
var primaryKeys = Object.keys(this.daoFactory.primaryKeys)
......
......@@ -259,6 +259,7 @@ module.exports = (function() {
, i
, scope
, scopeName
, scopeOptions
, argLength = arguments.length
, lastArg = arguments[argLength-1]
......
......@@ -139,6 +139,7 @@ module.exports = (function() {
, isEnum = definition.type && (definition.type.toString() === DataTypes.ENUM.toString())
, isMySQL = ['mysql', 'mariadb'].indexOf(self.daoFactory.daoFactoryManager.sequelize.options.dialect) !== -1
, ciCollation = !!self.daoFactory.options.collate && self.daoFactory.options.collate.match(/_ci$/i)
, valueOutOfScope
// Unfortunately for MySQL CI collation we need to map/lowercase values again
if (isEnum && isMySQL && ciCollation && (attrName in values) && values[attrName]) {
......
......@@ -32,6 +32,8 @@ module.exports = (function() {
.on('result', function(results) {
results
.on('row', function(row, metadata) {
var type
for (var prop in row) {
if (row.hasOwnProperty(prop)) {
if (row[prop] === null) {
......
......@@ -61,7 +61,9 @@ module.exports = (function() {
var query = new Query(self.client, self.sequelize, callee, options || {})
return query.run(sql)
.complete(function(err) { done && done(err) })
.complete(function(err) {
self.endQuery.call(self)
done && done(err) })
.success(function(results) { self.endQuery.call(self) })
.error(function(err) { self.endQuery.call(self) })
.proxy(emitter)
......
......@@ -145,10 +145,14 @@ module.exports = (function() {
},
arrayValue: function(value, key, _key, factory){
var col = null
, coltype = null
, _realKey = key.split('.').pop()
, _value
if (value.length === 0) { value = [null] }
var col = null, coltype = null
// Special conditions for searching within an array column type
var _realKey = key.split('.').pop()
if (!!factory && !!factory.rawAttributes[_realKey]) {
col = factory.rawAttributes[_realKey]
coltype = col.type
......
......@@ -42,8 +42,13 @@ module.exports = (function() {
self.database[getDatabaseMethod.call(self)](self.sql, function(err, results) {
// allow clients to listen to sql to do their own logging or whatnot
self.emit('sql', self.sql)
this.columnTypes = columnTypes;
err ? onFailure.call(self, err) : onSuccess.call(self, results, this)
if (err) {
onFailure.call(self, err)
} else {
this.columnTypes = columnTypes
onSuccess.call(self, results, this)
}
})
}
}
......
......@@ -817,7 +817,7 @@ module.exports = (function() {
QueryInterface.prototype.setIsolationLevel = function(transaction, value) {
if (!transaction || !(transaction instanceof Transaction)) {
throw new Error('Unable to set isolatipn level for a transaction without transaction object!')
throw new Error('Unable to set isolation level for a transaction without transaction object!')
}
var sql = this.QueryGenerator.setIsolationLevelQuery(value)
......
......@@ -6087,6 +6087,9 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
})
it('on success', function(done) {
var beforeHook
, afterHook
this.User.beforeDelete(function(user, fn) {
beforeHook = true
fn()
......@@ -6107,6 +6110,9 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
})
it('on error', function(done) {
var beforeHook
, afterHook
this.User.beforeDelete(function(user, fn) {
beforeHook = true
fn()
......@@ -6142,6 +6148,9 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
})
it('on success', function(done) {
var beforeHook
, afterHook
this.User.hook('beforeDelete', function(user, fn) {
beforeHook = true
fn()
......@@ -6162,6 +6171,9 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
})
it('on error', function(done) {
var beforeHook
, afterHook
this.User.hook('beforeDelete', function(user, fn) {
beforeHook = true
fn()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!