JsonHelper
class JsonHelper (View source)
Methods
static string|array
wrapJsonFunction(string|null $where = null, string|null $slug = null, Connection $connection)
Prepare a given $where and $slug to be used in a query, depending on whether or not the current platform supports JSON functions
Details
static string|array
wrapJsonFunction(string|null $where = null, string|null $slug = null, Connection $connection)
Prepare a given $where and $slug to be used in a query, depending on whether or not the current platform supports JSON functions
For example, wrapJsonFunction('foo', 'bar') gives:
Older SQLite, Mysql 5.6 -> [ 'foo', '["bar"]' ] Newer SQLite, Mysql 5.7 -> [ "JSON_EXTRACT(foo, '$[0]')", 'bar' ]