Re: Fwd: [PHP-BUG] Bug #73234 [NEW]: emulated statementsletvalue dictate parameter type
| From: | Christoph M. Becker | Date: | Tue, 04 Oct 2016 14:59:52 +0000 |
| Subject: | Re: Fwd: [PHP-BUG] Bug #73234 [NEW]: emulated statementsletvalue dictate parameter type | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96224@lists.php.net to get a copy of this message | ||
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