From ac52394746add87de0ea1eb7553a6d781f1ae32c Mon Sep 17 00:00:00 2001 From: eugene-frb Date: Tue, 10 Nov 2015 14:48:52 -0800 Subject: [PATCH 1/2] 1. Error logging. 2. Options argument of model's include function to pass filter.where object. --- lib/sql.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/sql.js b/lib/sql.js index 948afe1..e90634b 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -406,6 +406,10 @@ SQLConnector.prototype.execute = function(sql, params, options, callback) { }; this.notifyObserversAround('execute', context, function(context, done) { self.executeSQL(context.req.sql, context.req.params, context.options, function(err, info) { + if(err){ + debug('Error: %j %j %j', err, context.req.sql, context.req.params); + } + if (!err && info != null) { context.res = info; } @@ -1065,6 +1069,10 @@ SQLConnector.prototype.all = function find(model, filter, options, cb) { return self.fromRow(model, obj); }); if (filter && filter.include) { + if(filter.where) { + options.filterWhere = filter.where; + } + self.getModelDefinition(model).model.include( objs, filter.include, options, cb); } else { From 0cb12f085bb2e4bcfc0f2700e4f130f6cc5e0e08 Mon Sep 17 00:00:00 2001 From: eugene-frb Date: Thu, 19 Nov 2015 11:18:17 -0800 Subject: [PATCH 2/2] Removed filterWhere option The correct place to set this option that triggers injection of PARTITION BY clause is includeHasMany() in juggler.js. --- lib/sql.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/sql.js b/lib/sql.js index e90634b..d9848ec 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -1069,10 +1069,6 @@ SQLConnector.prototype.all = function find(model, filter, options, cb) { return self.fromRow(model, obj); }); if (filter && filter.include) { - if(filter.where) { - options.filterWhere = filter.where; - } - self.getModelDefinition(model).model.include( objs, filter.include, options, cb); } else {