Skip to content

Commit bd3f4a4

Browse files
committed
Merge pull request balderdashy#79 from leedm777/limit-fix
Only supply LIMIT hack when necessary.
2 parents 16a364a + 003dd12 commit bd3f4a4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/sql.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,14 @@ var sql = {
299299

300300
if (options.limit) {
301301
queryPart += 'LIMIT ' + options.limit + ' ';
302-
} else {
303-
// Some MySQL hackery here. For details, see:
304-
// http://stackoverflow.com/questions/255517/mysql-offset-infinite-rows
305-
queryPart += 'LIMIT 18446744073709551610 ';
306302
}
307303

308304
if (options.skip) {
305+
// Some MySQL hackery here. For details, see:
306+
// http://stackoverflow.com/questions/255517/mysql-offset-infinite-rows
307+
if (!options.limit) {
308+
queryPart += 'LIMIT 18446744073709551610 ';
309+
}
309310
queryPart += 'OFFSET ' + options.skip + ' ';
310311
}
311312

0 commit comments

Comments
 (0)