Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100137 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13740 invoked from network); 31 Jul 2017 12:30:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2017 12:30:22 -0000 Authentication-Results: pb1.pair.com header.from=newaltgroup@bk.ru; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=newaltgroup@bk.ru; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain bk.ru designates 94.100.177.99 as permitted sender) X-PHP-List-Original-Sender: newaltgroup@bk.ru X-Host-Fingerprint: 94.100.177.99 smtp39.i.mail.ru Received: from [94.100.177.99] ([94.100.177.99:56830] helo=smtp39.i.mail.ru) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/9D-07025-6A02F795 for ; Mon, 31 Jul 2017 08:20:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bk.ru; s=mail; h=References:To:Cc:In-Reply-To:Date:Subject:Mime-Version:Content-Type:Message-Id:From; bh=BiXbIaVo+qB1zyxVqblGyhs8w8x3f3obJ5TWfXrt9NM=; b=DkEK2Q3+njzjZqaHrCSmYW/Y0WQdcjeU2XsTiopc/DJ9O/V57HZa7ZBCNmgyEEWUVnVAO2wLxlQF3V+4fGW7r3OR1X48x3YDgJJx77Z0O8m8X8miVAAe3naracAjWt3+jA3ZO3X9cPMffMQ1aC0cUcO/7wVvz1ar81sv06KrvJ4=; Received: by smtp39.i.mail.ru with esmtpa (envelope-from ) id 1dc9gp-0007f4-BZ; Mon, 31 Jul 2017 15:20:51 +0300 Message-ID: <61FAECB0-F3F4-49A7-AEA4-B437542375BB@bk.ru> Content-Type: multipart/alternative; boundary="Apple-Mail=_A4D1CD08-7BC5-46CE-9857-E02203CA9B81" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Date: Mon, 31 Jul 2017 15:20:46 +0300 In-Reply-To: Cc: "internals@lists.php.net" To: Dan Ackroyd References: <1907EFF3-ED77-4F5C-85AA-CDFE323369C5@bk.ru> <880CDC06-17D6-4E40-8A48-F2E1CB405667@bk.ru> <2A653728-97CA-4AA5-BA30-5BF26FABBC2A@bk.ru> X-Mailer: Apple Mail (2.3273) Authentication-Results: smtp39.i.mail.ru; auth=pass smtp.auth=newaltgroup@bk.ru smtp.mailfrom=newaltgroup@bk.ru X-7FA49CB5: 0D63561A33F958A5E354962956F6CEDAB61826FE0A741A806D6F75FF592C3983725E5C173C3A84C307FFBFDCC3B3F350179B937655359CA1156CCFE7AF13BCA4B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DB48C21F01D89DB561574AF45C6390F7469DAA53EE0834AAEE X-Mailru-Sender: 5359E0D685F10627A37960CE49917681BAF9631173BDAA32BC3A6D9689E9125DAF26EC2CB6976A5918C1F6AB3FBD83F13DDE9B364B0DF289B1C9E140B68917A5027D9DD7AE851095AE208404248635DF X-Mras: OK Subject: Re: [PHP-DEV] [Request][Discussion] Introduce interfaces PDOInterface and PDOStatementInterface From: newaltgroup@bk.ru (Andrew Nester) --Apple-Mail=_A4D1CD08-7BC5-46CE-9857-E02203CA9B81 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 31, 2017, at 2:59 PM, Dan Ackroyd = wrote: >=20 > On 31 July 2017 at 12:49, Andrew Nester wrote: >>=20 >> To make it possible to have persistent PDO with custom PDOStatement = you >> should have: >>=20 >> 1) custom `CustomPDO implements PDOInterface` which will be somewhat = proxy to PDO instance >> 2) custom `CustomPDOStatement implements PDOStatementInterface`... >=20 > "I think you should be more explicit here between steps one and two. > http://www.sciencecartoonsplus.com/pages/gallery.php >=20 > 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. >=20 > That PDO with persistent connections doesn't support > ATTR_STATEMENT_CLASS hints that it is doing some magic internally. >=20 > Working around that magic in userland, while preserving the persistent > connection functionality might be 'non-trivial'. >=20 > Actually, there should be tests for that functionality as part of the > PR, probably. >=20 > cheers > Dan Yes, sure. I=E2=80=99m just thinking that instead of creating own example, it=E2=80=99= s better to take real one. Here is the issue in Doctrine DBAL code similar to the one we=E2=80=99re = discussing. 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/Resu= ltStatement.php = = https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/Stat= ement.php = = https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/Conn= ection.php = Here is example implementation of this interfaces = https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/PDOS= tatement.php = = https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Driver/PDOC= onnection.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=E2=80=99s 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=E2=80=99t think that concrete implementation of interfaces should = be included in tests because it=E2=80=99s just one of use case of these = new interfaces (not the easiest one and there could be more of them)= --Apple-Mail=_A4D1CD08-7BC5-46CE-9857-E02203CA9B81--