From cdc7ae6c8226ac4db99b1117cfd8af7a4923d543 Mon Sep 17 00:00:00 2001 From: Henri Bergius Date: Tue, 6 Mar 2012 14:08:27 +0100 Subject: [PATCH] Don't add a WHERE if there are no constraints --- lib/adapters/mysql.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/adapters/mysql.js b/lib/adapters/mysql.js index 3b0ad279..74acca95 100644 --- a/lib/adapters/mysql.js +++ b/lib/adapters/mysql.js @@ -241,6 +241,9 @@ MySQL.prototype.all = function all(model, filter, callback) { cs.push(keyEscaped + ' = ' + val); } }); + if (cs.length === 0) { + return ''; + } return 'WHERE ' + cs.join(' AND '); }