Re: PDO - Cannot retrieve warnings with emulated prepares disabled [message #183518 is a reply to message #183517] |
Tue, 29 October 2013 20:06 |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma:
|
Senior Member |
|
|
Jerry Stuckle wrote:
> On 10/29/2013 2:19 PM, Thomas 'PointedEars' Lahn wrote:
>> Thomas Mlynarczyk wrote:
>>> Thomas 'PointedEars' Lahn schrieb:
>>>> I presume reading the changelog will tell.
>>>
>>> I couldn't find anything relating to this issue there.
>>
>> Too bad. UTSL?
>>
>>>> >> 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.
>>>>
>>>> Not here; the attribute is not even supported:
>>>>
>>>> $ php -r '
>>>> $pdo = new PDO("mysql:host=localhost", "…", "…");
>>>> var_dump($pdo->getAttribute(PDO::ATTR_EMULATE_PREPARES));'
>>>> PHP Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not
>>>> support this function: driver does not support that attribute in
>>>> Command line code on line 3
>>>> PHP Stack trace:
>>>> PHP 1. {main}() Command line code:0
>>>> PHP 2. PDO->getAttribute() Command line code:3
>>>> bool(false)
>>>
>>> Yes, I get that error too -- which is all the more confusing, since
>>> otherwise the behaviour with PDO::ATTR_EMULATE_PREPARES == false is
>>> consistent with the assumption that prepared statements are indeed
>>> supported. See my reply to Jerry.
>>
>> Both Jerry and you are wrong.
>>
>> Prepared statements have been supported in MySQL since version 4.1 (as
>> you can read in the MySQL manual), and with the “pdo_mysql” extension
>> since its
>> first version (as you can read in the PHP manual). Naturally, therefore
>> they have always been supported with the “mysql” and “mysqli” extensions
>> *too*, provided your MySQL client library and the MySQL server accessed
>> with it were recent enough.
>
> I was not discussing the pdo_mysql extension. I was discussing the
> mysql_extension - which does NOT support prepared statements. And
> pdo_mysql in PHP 4.1 only emulated prepared statements; it did not
> support the MySQL version of prepared statements directly.
You have written, quote:
| I could be wrong, but from my experience, the mysql driver has never
| supported prepared statements, while the mysqli driver has always
| supported them. This is why PDO has to emulate the prepared statements.
End of quote.
Since you are so fond of scatological references, here is one for you:
You have written bullshit. Can you at least, for once, stand by that?
>> Jerry is also confusing “mysql”, “mysqli”, and “pdo_mysql”, which are
>> *separate* ext ensions (you are using the latter). *You* are confusing
>> the MySQL client (library) – that is *used by* a database driver – with a
>> database driver (for PHP).
>
> No, I am not. If I had meant pdo_mysql, I would have SAID pdo_mysql.
You have said pdo_mysql had to emulate prepared statements because some
“mysql driver” was not capable. This is bullshit.
>> “pdo_mysql” is a PHP extension that provides a PDO driver (a database-
>> specific driver that implements the PDO interface as provided by the
>> “pdo” PHP extension); “mysql” and “mysqli” are PHP extensions that
>> provide only MySQL drivers.
>
> Wow - you can copy and paste!
I have written this from scratch, stupid.
>> “pdo_mysql” does _not_ use nor require either the “mysql” or the “mysqli”
>> extension. As a result, if you have “pdo_mysql” loaded (which is only
>> possible if you load “pdo” first), and no applications on your server
>> that use the mysql*_* functions/methods, you can disable the other two
>> without
>> your applications that use “pdo_mysql” stopping to function. BTDT.
>
> You mean the PDO authors wrote their own mysql client library?
I have said nothing of the sort. You have not even understood the
difference between a database driver and a database client library despite
it has been given to you *in graphical form*. How stupid are you anyway?
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(at)news(dot)demon(dot)co(dot)uk>
|
|
|