Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #11617 > unrolled thread

PDO - Cannot retrieve warnings with emulated prepares disabled

Started byThomas Mlynarczyk <thomas@mlynarczyk-webdesign.de>
First post2013-10-28 23:30 +0100
Last post2013-10-30 21:09 +0100
Articles 3 on this page of 23 — 5 participants

Back to article view | Back to comp.lang.php


Contents

  PDO - Cannot retrieve warnings with emulated prepares disabled Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-10-28 23:30 +0100
    Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-29 13:10 +0100
      Re: PDO - Cannot retrieve warnings with emulated prepares disabled Tim Streater <timstreater@greenbee.net> - 2013-10-29 12:23 +0000
      Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-10-29 13:31 +0100
        Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-29 13:47 +0100
          Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-10-29 16:26 +0100
            Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-29 19:19 +0100
              Re: PDO - Cannot retrieve warnings with emulated prepares disabled Jerry Stuckle <jstucklex@attglobal.net> - 2013-10-29 15:55 -0400
                Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-29 21:06 +0100
                  Re: PDO - Cannot retrieve warnings with emulated prepares disabled Jerry Stuckle <jstucklex@attglobal.net> - 2013-10-29 20:57 -0400
                    Re: PDO - Cannot retrieve warnings with emulated prepares disabled Christoph Michael Becker <cmbecker69@arcor.de> - 2013-10-30 02:59 +0100
                      Re: PDO - Cannot retrieve warnings with emulated prepares disabled Jerry Stuckle <jstucklex@attglobal.net> - 2013-10-29 22:04 -0400
        Re: PDO - Cannot retrieve warnings with emulated prepares disabled Jerry Stuckle <jstucklex@attglobal.net> - 2013-10-29 08:58 -0400
          Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-10-29 16:22 +0100
            Re: PDO - Cannot retrieve warnings with emulated prepares disabled Jerry Stuckle <jstucklex@attglobal.net> - 2013-10-29 16:09 -0400
              Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-29 21:50 +0100
                Re: PDO - Cannot retrieve warnings with emulated prepares disabled Jerry Stuckle <jstucklex@attglobal.net> - 2013-10-29 21:01 -0400
              Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-10-29 23:11 +0100
                Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-30 01:12 +0100
                  Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-10-30 15:38 +0100
                Re: PDO - Cannot retrieve warnings with emulated prepares disabled Jerry Stuckle <jstucklex@attglobal.net> - 2013-10-29 21:10 -0400
                  Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-10-30 15:51 +0100
    Re: PDO - Cannot retrieve warnings with emulated prepares disabled Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-10-30 21:09 +0100

Page 2 of 2 — ← Prev page 1 [2]


#11644

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-10-29 21:10 -0400
Message-ID<l4pmao$8g3$1@dont-email.me>
In reply to#11638
On 10/29/2013 6:11 PM, Thomas Mlynarczyk wrote:
> Jerry Stuckle schrieb:
>
>> Do you get a result from the 'Select 5 + "Five"'?  If so, what is it?
>
> Yes, I get a result -- see below. I did some more testing:
>
> $pdo = new PDO( 'mysql:...', '...', '...' );
> var_dump( $pdo->setAttribute( PDO::ATTR_EMULATE_PREPARES, false ) );
> var_dump( $stmt = $pdo->prepare( 'SELECT 5 + "Five"' ) );
> var_dump( $stmt->execute() );
> var_dump( $stmt->fetchAll( PDO::FETCH_ASSOC ) );
> var_dump( $pdo->query( 'SHOW WARNINGS' )
>      ->fetchAll( PDO::FETCH_ASSOC ) );
>
> Return values with PDO::ATTR_EMULATE_PREPARES = false:
> setAttribute  -> true
> prepare       -> PDOStatement
> execute       -> true
> fetchAll      -> array( '5 + "Five"' => (float) 5 )
> SHOW WARNINGS -> (empty array)
>
> Return values with PDO::ATTR_EMULATE_PREPARES = true:
> setAttribute  -> true
> prepare       -> PDOStatement
> execute       -> true
> fetchAll      -> array( '5 + "Five"' => (string) '5' )
> SHOW WARNINGS -> array with warning
>
> Results are the same with PHP 5.4.8 and PHP 5.4.21. Note the different
> return types of the value 5 -- float vs. string. This surprises me a
> little -- why would the setting for emulation of prepared statements
> influence the *returned* data?
>
>> Also, what happens if you try "Select 5 + 'Five'"? (note different
>> quoting).
>
> No change.
>
>> I'm beginning to think you've found a bug in the PDO extension, but
>> I'm not sure (yet).
>
> Hm. I tested with PHP 5.4.8 and 5.4.21 and it didn't work. But it
> obviously worked with PHP 5.4.15 as both Thomas Lahn's and my own test
> on a different server have shown. In both cases, MySQL 5.5 is involved
> whereas my local system is still on MySQL 5.1.41. This leads me to think
> that it's not (or at least not entirely) a PDO issue.
>
> Greetings,
> Thomas
>

Thomas,

I'm not sure it isn't a PDO issue.  Just because it worked with MySQL 
5.5 and didn't with MySQL 5.1.41 is not entirely conclusive.  Only if 
there was a change in the error/warning handling between MySQL 5.1.41 
and 5.5 would it be entirely MySQL.

I might recommend you check the change logs for MySQL between 5.1.41 and 
5.5.  Alternately, you could follow up on comp.databases.mysql and see 
if there is a change.  This would help determine if a change in MySQL 
accounts for your difference in processing.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#11657

FromThomas Mlynarczyk <thomas@mlynarczyk-webdesign.de>
Date2013-10-30 15:51 +0100
Message-ID<l4r6di$fj6$1@news.albasani.net>
In reply to#11644
Jerry Stuckle schrieb:

> I might recommend you check the change logs for MySQL between 5.1.41 and 
> 5.5.  Alternately, you could follow up on comp.databases.mysql and see 
> if there is a change.  This would help determine if a change in MySQL 
> accounts for your difference in processing.

Thanks for the suggestion. I will take a look there when my time permits it.

Greetings,
Thomas


-- 
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)

[toc] | [prev] | [next] | [standalone]


#11663

FromThomas Mlynarczyk <thomas@mlynarczyk-webdesign.de>
Date2013-10-30 21:09 +0100
Message-ID<l4rp2g$dit$1@news.albasani.net>
In reply to#11617
I have done some more testing.
PHP 5.4.13, MySQL 5.1.66 -> no warning
PHP 5.4.15, MySQL 5.5.31 -> warning works

But I've also noticed that the two installations above don't seem to use 
mysqlnd. There's no mysqlnd section in phpinfo() and the pdo_mysql 
section has the client API version identical to the MySQL version, 
whereas in installations with mysqlnd the client API version is listed 
as mysqlnd 5.0.10 - 20111026. (Unless this is somehow a consequence of 
the fact that the two installations above use the Apache module while 
the "mysqlnd installations" that I checked both run PHP as CGI/FastCGI.)

There is a correlated side effect: the non-mysqlnd installations always 
return data as strings, whereas the mysqlnd installations return data 
with their real type (int, float or string) if emulated prepares are off.

Greetings,
Thomas

-- 
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.php


csiph-web