-
Notifications
You must be signed in to change notification settings - Fork 2
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
Select: Add support for locking clauses #55
base: main
Are you sure you want to change the base?
Conversation
*/ | ||
public function buildFor($lockStrength) | ||
{ | ||
$sql = []; |
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.
Why not just return ! empty($lockStrength) ? "FOR $lockStrength" : ""
?
/** | ||
* Build the locking clause of a query | ||
* | ||
* @param ?string $lockStrength |
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.
Why not just string
here?
* | ||
* @param string $lockStrength | ||
* | ||
* @return self |
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.
Should be @return $this
.
/** | ||
* Build the locking clause of a query | ||
* | ||
* @param ?string $lockStrength |
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.
I couldn't find the ANSI-SQL definition, but read that this is defined in ANSI-SQL (to an extent, of course). Here is what I found about the implementation in our supported databases:
- MySQL only supports FOR UPDATE
- Oracle and PostgreSQL support is pretty extensive
- DB2 supports FOR UPDATE and FOR READ ONLY
- MSSQL of course does something different and implements this via table hints
Because of the different implementations, I would say locking clause
instead of lock strength
everywhere. And don't bother with MSSQL for now.
No description provided.