Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117869 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96363 invoked from network); 7 Jun 2022 17:43:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Jun 2022 17:43:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5D93D18050B for ; Tue, 7 Jun 2022 12:29:38 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com [209.85.217.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 7 Jun 2022 12:29:37 -0700 (PDT) Received: by mail-vs1-f45.google.com with SMTP id c62so17620814vsc.10 for ; Tue, 07 Jun 2022 12:29:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=khXmgIO1rQC1JRNr7i2GIYBPcdnyOhqUrMhXfwrC2gE=; b=U/BNXD6C5KHz86dPc3cWKlsVzrcr+Uthxdd9q5TpdteXqXB4wOk43e+HSuCefuzk15 Ayo/9ztFrkYQdxl8ZvFcHQ8lWgGDkgNUWJKoHGT8ZHSX4a/w0fjaCE6geUmwpl2kE4yU PLSzjXHjN8uIofC3SccZWhbvWok3l2L1Lay9POx+7By2nWjcLqUEY0cODQe3iBxHkPwj K1n1h7S3SwNq5BtreJ5oQlbQQID0KLvTxr3fyikapOCms/YcHZs7RSTkZGa/FDcw1aV1 rB0tvUsIAnpsXI7JQeST710jA4pn9Dh0lH3h1YouLCbFHrK89IS3EIkd9XWa457WwT57 4rFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=khXmgIO1rQC1JRNr7i2GIYBPcdnyOhqUrMhXfwrC2gE=; b=QRMH4OiloTiIpulT2wsrbP0sHgfmw0KwiU9iTn4kgXjAy8fR0qGK39r6LggZ7v6w1Y AKdMlP0jIbYo8knlfvvgaGDlEcl0adzd3XP3F8ViQaAMmY4iuaDBOq9TGFC1IukNnrRI jexpICRBmE2JAPki7yJ7kydZpbZALLPyz6B56w/RA7UmZe5eZzZF+mL02QOHysv7RlxP QFqy5OtTo/vqknaqH6SligSYxV5Kks0NPmN2D5l/0mos/pngBPuHIFjwi13Iblz0Jw2z 50yrvAIEsvTyyd2Vv6421sHpJK8FUGGHNtSJwVoggm1MEStAeHzjzAy3FBdGFQjLYmTQ rTyg== X-Gm-Message-State: AOAM533GG07/KB9op+gv9zO08qxCDvMu6TX6lXssH6NMMGL/YhpTIAOZ p2q2KaXvaKT+GeqGHngaXwdFP+39F+IzsBX3sE7h4ihvRjA= X-Google-Smtp-Source: ABdhPJw23RbSmJx4nsNBfHeDdclhN3v26Pc7pxAo8aYrScAdVOJEQH5v/I8IVHtua1C78dGhnrQmZmUenYOn0pjpqZA= X-Received: by 2002:a05:6102:a90:b0:34b:be12:91d1 with SMTP id n16-20020a0561020a9000b0034bbe1291d1mr6169197vsg.19.1654630177010; Tue, 07 Jun 2022 12:29:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 7 Jun 2022 21:29:25 +0200 Message-ID: To: Dan Ackroyd Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000ef791505e0e09b9a" Subject: Re: [PHP-DEV] DB specific PDO subclasses questions. From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --000000000000ef791505e0e09b9a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Dan, pon., 6 cze 2022 o 21:15 Dan Ackroyd napisa=C5=82(= a): > Hi, > > I'm looking at making an RFC for subclassing PDO to expose database > specific methods in a less magic way, aka implementing what was > discussed here: https://externals.io/message/100773#100813 > > I have two questions for people who use the PDO with SQLite or Postgres > > 1. Are any of the functions that are specific to those databases > horribly designed and need changing? As the functions would be 'copied > across' from where they are now, changes could be made without having > horrible BC breaks. > > That is, are any of these functions horrible to use: > > PDO::pgsqlCopyFromArray > PDO::pgsqlCopyFromFile > PDO::pgsqlCopyToArray > PDO::pgsqlCopyToFile > PDO::pgsqlGetNotify > PDO::pgsqlGetPid > PDO::pgsqlLOBCreate > PDO::pgsqlLOBOpen > PDO::pgsqlLOBUnlink > > SQLIte specific functions: > PDO::sqliteCreateAggregate > PDO::sqliteCreateCollation > PDO::sqliteCreateFunction > I admire you for picking up the gauntlet. Personally, I'm not convinced about these methods being in PDO or in subclasses at all. Since PDO is a non-final class someone could already extend it and build their own functionality around that. If so, then how would it be solved? Auto-magically extending after let's say PDOSqlite3 ?? I'd think of extracting driver-specific methods into a Driver / Platform standalone type like PDODriver / PDOPlatform that is responsible for all driver-specific methods and attributes to carry. That one could be fetched from the PDO instance object with a new dedicated method like "getDriver" / "getPlatform" whatever, maybe a typed read-only property (that would be an interesting option). That way classes like PDOPgSQLDriver or PDOSqlite3Driver might have all the driver methods and avoid introducing new magic related to inheritance. There might be a transition period where these could be proxied like currently in PDO with deprecation error, which allows for a smoother transition. Maybe it is just because of using Doctrine DBAL often, but IMO here a better input might have its contributors. Best regards, Micha=C5=82 Marcin Brzuchalski --000000000000ef791505e0e09b9a--