-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Fix support for BETWEEN predicate in database class #6292
Fix support for BETWEEN predicate in database class #6292
Conversation
Fixes BETWEEN predicate for SQL queries.
Update Query.php
Fix to support BETWEEN predicate in database query abstraction.
@SeriousKen don't worry about the failing code styling test. We changed something on our CI yesterday and the reviewdog action seems to be broken right now. |
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.
Looks good to me (thanks!). Leaving the final review to @lukasbestle as he knows those SQL classes much better.
BETWEEN operator also supports text values like |
I can't see any reason why it would not support strings as it ultimately gets translated into to a prepared statement with parameters. |
Great! So could you add unit test for strings please? |
No problem, test added |
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.
Awesome, thanks!
This PR …
Fixes
Using BETWEEN in a where was not supported in the 3 argument form (eg. Db::table('products')->where('quantity', 'BETWEEN', [10, 20])) this PR fixes this.
Breaking changes
None
Docs
You can now use
Db::table('products')->where('quantity', 'BETWEEN', [$min, $max])
to add a BETWEEN clause to a query.Ready?
For review team