Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for specifying an offset without a limit #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

titaniumlou
Copy link
Contributor

offset can now be specified and used without having to specify a limit

from http://dev.mysql.com/doc/refman/5.5/en/select.html

To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:

SELECT * FROM tbl LIMIT 95,18446744073709551615;

offset can now be specified and used without having to specify a limit
@dgsan
Copy link
Contributor

dgsan commented Sep 5, 2013

Unit tests?

@@ -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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't Math.pow(2,53) be calculated just once and just re-use that value here instead?

@titaniumlou
Copy link
Contributor Author

@mscdex yeah, that would be a better way to go 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants