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
PDO - Cannot retrieve warnings with emulated prepares disabled [message #183501] Mon, 28 October 2013 22:30 Go to previous message
Thomas Mlynarczyk is currently offline  Thomas Mlynarczyk
Messages: 131
Registered: September 2010
Karma:
Senior Member
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?

How can I get warnings and notices from MySQL in that case? PDO doesn't
seem to offer a method for retrieving them -- only for errors.

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: Tue Nov 26 12:41:23 GMT 2024

Total time taken to generate the page: 0.08822 seconds