-
Notifications
You must be signed in to change notification settings - Fork 369
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
Missing LIMIT if none specified, but OFFSET given / Patch attached #19
Comments
Hi, Thanks for the patch - I need to do a bit of research into how portable this is, as hardcoding a value like that seems a bit odd... Jamie |
Hi j4mie, yes, it also looked a bit odd to me, but since there's no way in standard SQL to ommit LIMIT, when also OFFSET is given, specifiying a LIMIT of 2^64 -1 == 18446744073709551615 (e.g. max value for an unsigned 64-bit integer, ULLONG_MAX from limits.h) seems to be the widely accepted solution (at least in MySQL - it is also shown in MySQL examples). Postgres, however supports a LIMIT ALL. Edit: Just checked the PHP docs; there does not seem to be a define for this value. Workaround:
|
It's the portability that worries me. I can't add MySQL-only code to Idiorm, and adding "special cases" for every database is something I'm trying to avoid wherever possible I'm actually struggling to see exactly why this is needed. Can't you just ensure that |
Hi j4mie, actually, I agree with your concerns about portability. I can of course ensure, that I'll use Apart from this Greetings |
This should be controlled by the application and not at the ORM level in my opinion and I don't like having a hard coded value in the ORM like this. |
Hey j4mie,
firstable, thanks for this great, simple ORM!
I just encountered a slight bug, when using $sth->offset(), but not specifiying a row limit count with $sth->limit(). The required LIMIT is not emitted in the final SQL (but required for the statement to work).
Following patch fixes the issue:
Thanks and regards,
ViFo.
The text was updated successfully, but these errors were encountered: