Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100881 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91743 invoked from network); 12 Oct 2017 16:40:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Oct 2017 16:40:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=lists@rhsoft.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lists@rhsoft.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain rhsoft.net designates 91.118.73.15 as permitted sender) X-PHP-List-Original-Sender: lists@rhsoft.net X-Host-Fingerprint: 91.118.73.15 mail.thelounge.net Received: from [91.118.73.15] ([91.118.73.15:21597] helo=mail.thelounge.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/89-49033-E0B9FD95 for ; Thu, 12 Oct 2017 12:40:48 -0400 Received: from srv-rhsoft.rhsoft.net (Authenticated sender: h.reindl@thelounge.net) by mail.thelounge.net (THELOUNGE MTA) with ESMTPSA id 3yCc6L39CVzXMZ for ; Thu, 12 Oct 2017 18:40:42 +0200 (CEST) To: internals@lists.php.net References: <000301d34351$03585950$0a090bf0$@roze.lv> <1507821396.2615.121.camel@schlueters.de> Message-ID: <47d17e93-0c76-b330-8116-343b2e27bc2e@rhsoft.net> Date: Thu, 12 Oct 2017 18:40:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1507821396.2615.121.camel@schlueters.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-CH Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Mysql result data types From: lists@rhsoft.net ("lists@rhsoft.net") 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)