From 5acfc21dd50fb4fd8fbb8719c000f0efebc1e795 Mon Sep 17 00:00:00 2001 From: Louis Orenstein Date: Thu, 29 Aug 2013 11:13:29 -0600 Subject: [PATCH] allow for specifying an offset without a limit offset can now be specified and used without having to specify a limit --- lib/mysql.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mysql.js b/lib/mysql.js index e27dceb..9ab131c 100644 --- a/lib/mysql.js +++ b/lib/mysql.js @@ -258,7 +258,7 @@ MySQL.prototype.all = function all(model, filter, callback) { sql += ' ' + buildOrderBy(filter.order); } - if (filter.limit) { + if (filter.limit || filter.skip) { sql += ' ' + buildLimit(filter.limit, filter.skip || 0); } @@ -355,7 +355,7 @@ MySQL.prototype.all = function all(model, filter, callback) { } function buildLimit(limit, offset) { - return 'LIMIT ' + (offset ? (offset + ', ' + limit) : limit); + return 'LIMIT ' + (offset ? (offset + ', ' + (limit || Math.pow(2,53))) : limit); } };