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

Commit c6c4e136 by Jan Aagaard Meier

Don't clone options in find and findall, since this is taken care of in Utils.format

1 parent 1b7aec39
Showing with 1 additions and 10 deletions
...@@ -325,8 +325,6 @@ module.exports = (function() { ...@@ -325,8 +325,6 @@ module.exports = (function() {
DAOFactory.prototype.findAll = function(options, queryOptions) { DAOFactory.prototype.findAll = function(options, queryOptions) {
var hasJoin = false var hasJoin = false
options = optClone(options)
if (typeof options === 'object') { if (typeof options === 'object') {
if (options.hasOwnProperty('include')) { if (options.hasOwnProperty('include')) {
hasJoin = true hasJoin = true
...@@ -379,7 +377,6 @@ module.exports = (function() { ...@@ -379,7 +377,6 @@ module.exports = (function() {
var primaryKeys = this.primaryKeys var primaryKeys = this.primaryKeys
, keys = Object.keys(primaryKeys) , keys = Object.keys(primaryKeys)
, keysLength = keys.length , keysLength = keys.length
options = optClone(options)
// options is not a hash but an id // options is not a hash but an id
if (typeof options === 'number') { if (typeof options === 'number') {
...@@ -809,13 +806,6 @@ module.exports = (function() { ...@@ -809,13 +806,6 @@ module.exports = (function() {
return attributes return attributes
} }
var optClone = function (options) {
return Utils._.cloneDeep(options, function (elem) {
// The DAOFactories used for include are pass by ref, so don't clone them. Otherwise return undefined, meaning, 'handle this lodash'
return elem instanceof DAOFactory ? elem : undefined
})
}
Utils._.extend(DAOFactory.prototype, require("./associations/mixin")) Utils._.extend(DAOFactory.prototype, require("./associations/mixin"))
return DAOFactory return DAOFactory
......
...@@ -55,6 +55,7 @@ var Utils = module.exports = { ...@@ -55,6 +55,7 @@ var Utils = module.exports = {
}, },
format: function(arr, dialect) { format: function(arr, dialect) {
var timeZone = null; var timeZone = null;
// Make a clone of the array beacuse format modifies the passed args
return SqlString.format(arr[0], arr.slice(1), timeZone, dialect) return SqlString.format(arr[0], arr.slice(1), timeZone, dialect)
}, },
formatNamedParameters: function(sql, parameters, dialect) { formatNamedParameters: function(sql, parameters, dialect) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!