On 04.10.2016 at 16:44, Adam Baratz wrote:

>>>> That's correct, but you can enable emulated prepares for whichever
>>>> driver.
>>>> A less confusing example might've been inserting :null into a nullable
>>>> INT
>>>> column and verifying that NULL was stored.
>>>
>>> That's not ture. If memory serves, emulated prepares are only available
>>> supported by the mysql and pgsql pdo drivers.
>>
>> If that is so, the docs would be in error, e.g.
>> <http://www.php.net/manual/en/pdo.setattribute.php> states:
>>
>> | PDO::ATTR_EMULATE_PREPARES […]
>> | Use this setting to force PDO to either always emulate prepared
>> | statements (if TRUE), […]
> 
> Yes, any driver can use emulated prepared statements:
> https://github.com/php/php-src/blob/master/ext/pdo/pdo_stmt.c#L483
> https://github.com/php/php-src/blob/master/ext/pdo/pdo_stmt.c#L1732

Yes, they *could*, but not all *do*.  E.g.

  (new PDO('sqlite::memory:'))
    ->setAttribute(PDO::ATTR_EMULATE_PREPARES, true)

returns FALSE.  Also pdo_sqlite will report NULL both times in your
original example.

FTR: I've documented this now
<http://svn.php.net/viewvc?view=revision&revision=340311>.

-- 
Christoph M. Becker

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to