Skip to content
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.2] Added correct MySQL JSON bool handling and updating grammar #13242

Merged
merged 2 commits into from
May 26, 2016
Merged

[5.2] Added correct MySQL JSON bool handling and updating grammar #13242

merged 2 commits into from
May 26, 2016

Conversation

sebwas
Copy link
Contributor

@sebwas sebwas commented Apr 21, 2016

Bool literals are now correctly inserted into statements that use a JSON column. E.g.

DB::table('test')->select('flags', 'another_column')->where('flags->active', true)->get();

Previously this was only possible using DB::raw('true').

Additionally the update grammar has been updated, so that JSON fields in the update array are recognized as such and make use of the JSON_SET function.

See code and tests for details and also see #13232 for the discussion to the where issue.

@GrahamCampbell GrahamCampbell changed the title Added correct MySQL JSON bool handling and updating grammar [5.2] Added correct MySQL JSON bool handling and updating grammar Apr 21, 2016
@GrahamCampbell
Copy link
Member

Wasn't this already added to 5.3?

@sebwas
Copy link
Contributor Author

sebwas commented Apr 21, 2016

If so, could you point out where?

@GrahamCampbell
Copy link
Member

Can't remember., Maybe it wasn't merged?

@taylorotwell taylorotwell merged commit 7937dcb into laravel:5.2 May 26, 2016
@taylorotwell
Copy link
Member

Merged, but have seen after the fact it doesn't seem to work for me at all. Boolean columns are not updated. No error is generated. Just nothing happens.

@taylorotwell
Copy link
Member

taylorotwell commented May 26, 2016

Looks to me like bindings for booleans aren't removed on update. So you end up with this kind of query: http://d.pr/i/1gvcH

Note that there are more bindings than placeholders.

@taylorotwell
Copy link
Member

I fixed the JSON updates with booleans.

@taylorotwell
Copy link
Member

Can you add a test so it doesn't break again?

@sebwas
Copy link
Contributor Author

sebwas commented May 28, 2016

Alright. I will do so in a bit. Cheers!

@sebwas sebwas deleted the mysql-json-bool-and-update branch May 28, 2016 10:51
@sebwas sebwas mentioned this pull request May 28, 2016
taylorotwell pushed a commit that referenced this pull request May 29, 2016
* Using mockery for consistency

* Add a test for removed bindings as per #13242
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants