Re: [Request][Discussion] Introduce interfaces PDOInterface and PDOStatementInterface

From: Date: Mon, 31 Jul 2017 15:00:28 +0000
Subject: Re: [Request][Discussion] Introduce interfaces PDOInterface and PDOStatementInterface
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-100139@lists.php.net to get a copy of this message
> On Jul 31, 2017, at 5:54 PM, Johannes Schlüter <johannes@schlueters.de> wrote: > > On Mo, 2017-07-31 at 14:49 +0300, Andrew Nester wrote: >> That’s actually the thing that you can’t use >> PDO::ATTR_STATEMENT_CLASS with persistent PDO. > > The actually question is: Why not? - From a quick glance on the code I > see no obvious reason. In speculation I assume the implementor thought > "Well, we can't guarantee that a class that is there in one request > will be there on the next release and it will quite certainly be at a > different memory address thus the cached class_entry pointer will be > wrong" but the user has to reset the attribute anyways ... we just have > to make sure the different dbh->def_stmt_flags are clean when a new PDO > connection object is created recovering an old connection ... > > johannes Besides code style/architecture things (which is of course questionable) the issue with ATTR_STATEMENT_CLASS is that it simply doesn’t work with persistent PDO connect and raises "General error: PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances"

« previous php.internals (#100139) next »