Posts: 31
Threads: 9
Joined: Aug 2018
Reputation:
0
05-04-2020, 09:13 AM
(This post was last modified: 05-04-2020, 09:21 AM by korgoth.)
Hello guys,
As of MySQL 5.7.8 there is a "JSON" data type supported in mysql databases.
It would be awesome if we get some query builder functions to work with those data types. I guess theres no way of that making it int he original builder driver, but maybe an Addin for that would be possible?
I find many many benefits in having this easy accessible from the query builder - what do you think? Do you have any ideas or thoughts on whether this is possible/doable?
Posts: 55
Threads: 25
Joined: Mar 2015
Reputation:
-1
Sounds great. Also looking for this solution (feature).
"Who thinks in code"
Perfectly describes who I am
mbparvez.me
Posts: 429
Threads: 38
Joined: Dec 2016
Reputation:
15
I don’t see any reason why this wouldn’t be part of the core. If it is an official MySQL data type then handling ought to be mandatory. How would this differ from a TEXT? Would the returned value be automatically run through json_decode()? Check out Entity casts for an example of handling this already at the entity level.
Posts: 429
Threads: 38
Joined: Dec 2016
Reputation:
15
Oh wow, yes that is quite powerful and quite complex. I would like to see native support for this but I agree, it would take some pretty heavy changes. It might be a good candidate to start as a separate module and eventually make its way in.
Posts: 4,380
Threads: 101
Joined: Oct 2014
Reputation:
146
I'll take a closer look at it in the morning to get the full grasp of it.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Posts: 4,380
Threads: 101
Joined: Oct 2014
Reputation:
146
MY intial take on this:
1) Would need to check the table for json column type.
2) To pull json data out of the table we would need to use the column path operator (->)
but then the data is surrounded by double quote marks ("data").
3) If the column type is json we would need to use the inline path operator to get the
column values (->>).
4) Queries would need to access the table data using the column-name and inline path operator (->>).
5) One problem I see here is the (column path operator ->) and the (inline path operator ->>)
(the -> and ->>) are going to interfere with the PHP operator (->).
5) This would also effect the DBForge.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )