-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
QueryBuilder's limit(0) returns all rows for some database types? #281
Comments
Hrm. Can you take a look at the generated query in the logs to see if the query is correct? In looking at the code, I don't see any specific logic around the limit value of 0 but this may be a problem with your database? What type are you using? I just wrote a test for this and all of my test database types passed fine but Derby and Hsql returned all results if limit(0). Derby doesn't support the limit (or at least my database type class doesn't) so the limit argument is ignored. Maybe I should throw an exception if the limit is used? Certainly there should be some docs on limit to say that it is database specific. Also HSQL doesn't seem to work either although I think ORMLite is generating the right query:
|
Hi, Specifying it in the doc would be good indeed; Maybe instead of an exception it could log a WARNING? (is there a general policy in ormlite for similar cases?). What about a WARNING + a default implementation for the DBs that do not support it? Not efficient, but helpful. BTW see the test, limit(x) works as expected with the exception of limit(0). |
Hello,
based on the javadoc
I expect that limit(0) returns 0 rows. Is my expectation correct? If so, I think there is a bug because
QueryBuilder qb = dao.queryBuilder().offset(0).limit(0);
returns all values.
The text was updated successfully, but these errors were encountered: