On Do, 2017-07-27 at 08:14 +0200, Michał wrote:
> Encoding data to insert query is simple. But selecting data requires 
> additional magic and processing.

The magic while reading is quite limited - at least for MySQL the
protocol contains a flag in the meta data telling whether a field is a
"arbitrary" string field or a JSON field, based on that one could
decode accordingly.

The question is what the user expects ...

One fact is that applications are already using those types, changing
the default behavior would be a break. Also some users might want to
just pass it to a JS frontend and decoding and renencding for the
transport is a wast of cpu cycles. Similar more "administrative"
applications like phpMyAdmin need exta handling as the value can'T be
printed simply anymore.

Thus we'd need a special flag like 

   $pdo->fetch(PDO::FETCH_ASSOC | PDO::FETCH_DECODE_JSON)


and from there there is little step for leaving this completely to the
user ... they know what they need.

johannes


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to