FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PDO - Cannot retrieve warnings with emulated prepares disabled
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PDO - Cannot retrieve warnings with emulated prepares disabled [message #183508 is a reply to message #183506] Tue, 29 October 2013 12:31 Go to previous messageGo to previous message
Thomas Mlynarczyk is currently offline  Thomas Mlynarczyk
Messages: 131
Registered: September 2010
Karma:
Senior Member
Thomas 'PointedEars' Lahn schrieb:
> Thomas Mlynarczyk wrote:
>
>> When I do this:
>>
>> $pdo = new PDO( /* MySQL connection */ );
>> // $pdo->setAttribute( PDO::ATTR_EMULATE_PREPARES, false );
>> $stmt = $pdo->prepare( 'SELECT 5 + "Five"' );
>> $stmt->execute();
>> var_dump( $pdo->query( 'SHOW WARNINGS' )
>> ->fetchAll( PDO::FETCH_ASSOC ) );
>>
>> I get a warning back:
>>
>> Warning 1292 Truncated incorrect DOUBLE value: 'Five'
>>
>> But when I uncomment the second line (disabling emulation of prepared
>> statements), "SHOW WARNINGS" returns an empty array. Why?

> I cannot reproduce that.

I just checked on a different server (more recent versions of both PHP
and MySQL) and indeed, there it works.

> PHP 5.4.15-1 (cli) (built: May 12 2013 12:17:45)
> mysql Ver 14.14 Distrib 5.5.33, for debian-linux-gnu (i686) using readline
> 6.2

PHP 5.4.8
MySQL 5.1.41

Hm. So it could either be a bug that was fixed in a later version or I
somehow messed up my local installation.

> PDO::ATTR_EMULATE_PREPARES == false should be the effective default for
> PDO_MySQL unless you are using an ancient MySQL version (why?) that does not
> support Prepared Statements.

My MySQL version does support them. Still, PDO's default seems to be
"on" for the emulation.

Greetings,
Thomas


--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: splitting list into columns
Next Topic: reading files with accents in the filename from PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Sep 19 22:25:11 GMT 2024

Total time taken to generate the page: 0.05642 seconds