-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0 #3248
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
morozov
commented
Aug 11, 2018
{ | ||
if ($limit === null && $offset > 0) { | ||
return $query . ' LIMIT -1 OFFSET ' . $offset; | ||
$limit = -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not strictly related to the issue, just a code duplication cleanup.
morozov
force-pushed
the
non-nullable-offset
branch
from
August 11, 2018 05:56
cd4e8b1
to
1ffceaa
Compare
morozov
force-pushed
the
non-nullable-offset
branch
from
August 11, 2018 05:59
1ffceaa
to
980a01f
Compare
Majkl578
approved these changes
Aug 11, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, makes sense.
morozov
added a commit
that referenced
this pull request
Sep 29, 2018
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Oct 7, 2018
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Oct 7, 2018
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Nov 14, 2018
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Nov 14, 2018
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Nov 25, 2018
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Dec 6, 2018
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Jan 20, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
to morozov/dbal
that referenced
this pull request
Feb 6, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
to morozov/dbal
that referenced
this pull request
Feb 6, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Feb 7, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Feb 20, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Feb 22, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Mar 15, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Mar 15, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Mar 18, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Apr 16, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
May 6, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
May 23, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
to morozov/dbal
that referenced
this pull request
May 31, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Jun 13, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Jun 27, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
to morozov/dbal
that referenced
this pull request
Aug 26, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
morozov
added a commit
that referenced
this pull request
Nov 2, 2019
Made the OFFSET in LIMIT queries non-nullable integer defaulting to 0
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Semantically, the absence of the offset in a
LIMIT
ed query ($offset = null
) means "start from the beginning", i.e. with the zero offset. Therefore,$offset = null
and$offset = 0
are semantically equivalent.From the practical standpoint, allowing
$offset = null
means that we have to cast it to an(int)
or consider its nullability during strict comparison.This patch makes the offset non-nullable defaulting to
0
. The usage of theNULL
offset in DBAL 2.x will be deprecated in favor of using0
.