-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[5.4] SqlServer join on delete #16618
Conversation
Also fixed a bug where using the join and calling the delete method passing an ID would throw an ambiguous error, ppl shouldn't do that but it's fixed just in case... |
@@ -2247,7 +2247,7 @@ public function delete($id = null) | |||
// the ID to allow developers to simply and quickly remove a single row | |||
// from their database without manually specifying the where clauses. | |||
if (! is_null($id)) { | |||
$this->where('id', '=', $id); | |||
$this->where($this->from.'.id', '=', $id); |
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.
Does this syntax cause any problems when you do a delete without a join? Does it care that you specify the table name in that case? We would need to verify that across all drivers.
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.
Yep, we need to verify that to be sure, it shouldn't cause any problems, but we should verify it just in case. I'll gather some feedback...
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've tested online on http://sqlfiddle.com/ and it works for all drivers it doesn't care for the table name at all...
This PR add support for join when deleting records using SqlServer, following the logic used on the MySQL grammar.
Example of the result:
Refs #16573