Re: [RFC] [Discussion] Implement SQLite "openBlob" feature in PDO
| From: | Marco Pivetta | Date: | Wed, 27 Sep 2017 09:04:09 +0000 |
| Subject: | Re: [RFC] [Discussion] Implement SQLite "openBlob" feature in PDO | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100780@lists.php.net to get a copy of this message | ||
On Wed, Sep 27, 2017 at 11:00 AM, Lester Caine <lester@lsces.co.uk> wrote:
> On 27/09/17 09:47, Dan Ackroyd wrote:
> >>
> >> https://wiki.php.net/rfc/implement_sqlite_openblob_in_pdo
> >
> > Couple of questions:
> >
> >> $stream = $pdo->sqliteOpenBlob('test', 'data', 1);
> > I tried reading the code but failed; what happens when this is called
> > on a PDO connection that isn't to an SQLite database? Also, there
> > should probably be tests around that behaviour.
>
> The bigger question is - Should database specific extensions to PDO be
> allowed at all? The WHOLE base of PDO was that it would allow easy data
> management between DIFFERENT databases. This should be implemented in a
> way that mirrors blobs generically otherwise the generic database driver
> should be used since a switch to another PDO driver will fail. This
> should apply to any targeted extension to PDO, so anything that breaks
> the generic base data needs tidying up.
>
First time I agree with Lester here, so please take note :-P
Unless the type of the connection is PDOSQLiteConnection, this specific
patch adds methods that are not interfaced, and need to be checked for
existence every time. This is error-prone and just an annoyance that will
likely need abstraction once it reaches "real world" (layers that isolate
apps from PDO's inherent radioactivity).
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/