Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #11639
| Message-ID | <6733482.EzixYvk0yd@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2013-10-30 01:12 +0100 |
| Subject | Re: PDO - Cannot retrieve warnings with emulated prepares disabled |
| Newsgroups | comp.lang.php |
| References | (2 earlier) <l4o9qm$1u3$1@news.albasani.net> <l4obdq$2ra$1@dont-email.me> <l4ojrc$mjc$1@news.albasani.net> <l4p4lj$um3$1@dont-email.me> <l4pbrg$9l6$1@news.albasani.net> |
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 ) );
You have a different order of fetching the result and fetching the warnings.
Please try my test cases.
> 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?
I have no idea.
The more important question is: Why would it matter *at* *all* in PHP 5.4.x
where by PDO_MySQL that attribute *is* *not* *supported* and *emulation*
*is* *not* *done* when using a MySQL 4.1+ client?
Something is utterly wrong with your local setup, and I assume it is at
least the MySQL version mismatch. First be clear which version of PHP,
MySQL client, and MySQL server you are using, *exactly*, and that you are
using the correct versions.
That said, why are you preparing invalid statements in the first place?
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web