Am 12.10.2017 um 17:16 schrieb Johannes Schlüter:
On Do, 2017-10-12 at 14:55 +0300, Reinis Rozitis wrote:
Hello,
is there a reason (technical or historical) why the data coming from
MySQL is always strings?
I've found only one case where the data type is "honored" -
PDO+mysqlnd+emulation off [1]
The reason for this is that this is the way the protocol works. With
non-prepared statements the server sends the data in textual form. With
prepared statements it switches to a different protocol sending values
in binary form.
There was a proposal in the server once that would use binary also for
non-prepared statements, but was rejected, for reasons i don't recall.
(maybe backwards compatibility)
MySQL's new X protocol uses binary representation by defalt, but is no
drop in replacment, but new protocol, with new clients etc
as i understand that below MYSQLI_OPT_INT_AND_FLOAT_NATIVE does not
convert but *return* native types and benchamrks support this
http://blog.ulf-wendel.de/2008/php-new-network-traffic-cpu-and-memory-savings-with-mysqlnd/
A new mysqlnd only option gives you 3). Try out mysqli_options($link,
MYSQLI_OPT_INT_AND_FLOAT_NATIVE, true)
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php