> On Jul 31, 2017, at 2:59 PM, Dan Ackroyd <dan...@basereality.com> wrote:
> 
> On 31 July 2017 at 12:49, Andrew Nester <newaltgr...@bk.ru> wrote:
>> 
>> To make it possible to have persistent PDO with custom PDOStatement you
>> should have:
>> 
>> 1) custom `CustomPDO implements PDOInterface` which will be somewhat proxy 
>> to PDO instance
>> 2) custom `CustomPDOStatement implements PDOStatementInterface`...
> 
> "I think you should be more explicit here between steps one and two.
> http://www.sciencecartoonsplus.com/pages/gallery.php
> 
> I'm not saying that's not going to work......I'm saying you should try
> to make a working example, to show that it works.
> 
> That PDO with persistent connections doesn't support
> ATTR_STATEMENT_CLASS hints that it is doing some magic internally.
> 
> Working around that magic in userland, while preserving the persistent
> connection functionality might be 'non-trivial'.
> 
> Actually, there should be tests for that functionality as part of the
> PR, probably.
> 
> cheers
> Dan

Yes, sure.

I’m just thinking that instead of creating own example, it’s better to take 
real one.

Here is the issue in Doctrine DBAL code similar to the one we’re discussing.
https://github.com/doctrine/dbal/issues/2315 
<https://github.com/doctrine/dbal/issues/2315>

And here you can see couple of interfaces have been created. These interfaces 
are mirror of PDO and PDOStatement interface.
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/ResultStatement.php
 
<https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/ResultStatement.php>
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/Statement.php
 
<https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/Statement.php>
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/Connection.php
 
<https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/Connection.php>

Here is example implementation of this interfaces
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/PDOStatement.php
 
<https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/PDOStatement.php>
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/PDOConnection.php
 
<https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/PDOConnection.php>

And they came into issue with using ATTR_STATEMENT_CLASS (mentioned above)

I absolutely agree with you that implementing persistent stuff in user land 
code is non-trivial thing but it’s just one of use case where interfaces could 
be useful.
But I think that code above proves need of these interfaces because they 
created them on their own. And in general I think it makes user code a bit more 
readable.

I don’t think that concrete implementation of interfaces should be included in 
tests because it’s just one of use case of these new interfaces (not the 
easiest one and there could be more of them)

Reply via email to