MySql stored function to retrieve PHP serialized data on fly.
input
: php serialized data stringpath
: path to properties to get, use/
to nested keydelimiter
: array properties result separator
input sample:
{
"tag": "value",
"array": [{
"key": "value1"
},{
"key": "value2"
}]
}
select one tag:
select parseSerialized('a:2:{s:3:"tag";s:5:"value";s:5:"array";a:2:{i:0;a:1:{s:3:"key";s:6:"value1";}i:1;a:1:{s:3:"key";s:6:"value2";}}}', 'tag', ';')
select multiple tags / array:
select parseSerialized('a:2:{s:3:"tag";s:5:"value";s:5:"array";a:2:{i:0;a:1:{s:3:"key";s:6:"value1";}i:1;a:1:{s:3:"key";s:6:"value2";}}}', 'array/key', ';')