-
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.3] fix bindings on update statements with advanced joins for all grammars #16368
Conversation
Needs full description of how fix addresses problem. Need for passing into this overriden prepareBindingsForUpdate method, etc. |
For different grammars, we need a different order for the bindings and values. Example Mysql: Example Postgres: That's why we need merge bindings and values in different way for each grammar |
@litvinchuk thank you, looks like the syntax for Postgres and SQL Server varies from MySQL, closing my other PR so that we can work on this one. |
@@ -166,18 +166,14 @@ protected function compileJsonUpdateColumn($key, JsonExpression $value) | |||
*/ | |||
public function prepareBindingsForUpdate(array $bindings, array $values) | |||
{ | |||
$index = 0; |
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 did you change this unrelated code?
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.
Bindings are coming in raw format now, so the processing should be changed accordingly and can be simplified.
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.
In that case how will the check for isJsonSelector
work? Since you say they are coming in with numeric keys? Won't $column
always be an integer?
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.
Previously we were receiving merged bindings and checked isJsonSelector
first count($values)
of items from bindings, because values always were first and the keys were of integer type.
In this case we can check only values and then merge with bindings and the keys can be of any type.
foreach ($values as $column => $value) { | ||
if ($this->isJsonSelector($column) && | ||
in_array(gettype($value), ['boolean', 'integer', 'double'])) { | ||
unset($bindings[$index]); | ||
unset($values[$column]); |
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.
$column
can be of any type, not only integer
solution for issue #16367, #16363