Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118088 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 41626 invoked from network); 24 Jun 2022 13:48:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jun 2022 13:48:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BEAC2180538 for ; Fri, 24 Jun 2022 08:38:16 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, 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-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) (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 ; Fri, 24 Jun 2022 08:38:16 -0700 (PDT) Received: by mail-vs1-f52.google.com with SMTP id 184so2686145vsz.2 for ; Fri, 24 Jun 2022 08:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nagAJN2r2b64T37MsRLPeYOinx1iHtas+cdZl+wNfmY=; b=EVWzvEOfeOcur14sVDg00XJjK1VQTRLhze5+Fw0DIgsqPsI1llY6B0W3TiP2jPwtgP Qe3BIIT6RzaPQ1GvWwqLWD8PrHYIIwRqUjxXTZOv+ShuG3aHxFjvjo7Vf2bD/LyXGxts dZ6yIbFQSDDM4T9Fei/UiOs7Bk95b5fCvWmX4MtYyj6tXZ177A7NHyXcBjuvdpJH2gf1 RljeaqHUnbmuWbptiSB/8HLB5lYTjg6hhmex7Yp2x0Oo3i6KVKTEi3jGX9C3EZxQ1ynA KOk1FBb+sF6YN4HYDDDGXQ7AB/bW3v0XDM7pVnRFGE4XamZGcXi4leZjaz8+hJ7OHajm vQ6Q== 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=nagAJN2r2b64T37MsRLPeYOinx1iHtas+cdZl+wNfmY=; b=QfY7M8lWYanSLisCRJDDcdJ70HngHubeiv6qzyBTUhTojxcOsxRLEqlYoJqbJeiXVb Ar9dbjE2HlNEUMSfHMI7zZQiYkOjvvm5xyzAhVz1LFbDCIO6gPR66YAPe7mGzmHVMkdC cCUVD5Uj7ZXA0skcGguN/FSpjgvKjj7cbMa971vey2nlcibkDCg+VUwyYuzorD6Up+Du MtTyy8kCTxgBEsXGMHA2GixhyF4udzAcqxhNIuWgqbUF8V4IVr8IeR0WVcSP9cZcgwrG K5JUSiLb02Feb5rtpYyb8ct0s0mlr9l1F1QB8K7K4i523sac/ZGV3yDccs8aufmYVqGb lGbQ== X-Gm-Message-State: AJIora8obTdz8og+fwWznazgv7cs7A8DKtsiIFs8qi9wPlGudJ1TvBtQ 9QdDMFgPRoY807LbBpj32S9RnCOpk/wTzgljf1v3eboerI3S/Q== X-Google-Smtp-Source: AGRyM1uTs+QFrBBVHGT1mYu+w/9F54HlyztZyw3ZtQT+HGnpafvgaVaU/i/0K7JVzUgjadfaoLWBb8XkDekN3gUhqQk= X-Received: by 2002:a67:d317:0:b0:354:2828:af91 with SMTP id a23-20020a67d317000000b003542828af91mr16367612vsj.2.1656085095689; Fri, 24 Jun 2022 08:38:15 -0700 (PDT) MIME-Version: 1.0 References: <62b1d83c.1c69fb81.3d597.8aa9SMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: <62b1d83c.1c69fb81.3d597.8aa9SMTPIN_ADDED_MISSING@mx.google.com> Date: Fri, 24 Jun 2022 16:38:02 +0100 Message-ID: To: Ben Ramsey , Larry Garfield Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Re: [RFC] [Under Discussion] PDO driver specific sub-classes From: Danack@basereality.com (Dan Ackroyd) Larry Garfield wrote: > "Create all DB sub-classes?" - I'd say they all should have subclasses, even > if empty. It's more consistent* that way, and you can then also rely on > instanceof giving you useful information rather than "well, it's not one of > the special ones, so beyond that, NFI." You can get the database type through $db->getAttribute(PDO::ATTR_DRIVER_NAME); On Tue, 21 Jun 2022 at 15:39, Ben Ramsey wrote: > > Is there a reason we shouldn't go ahead and add subclasses for all database connection types, YAGNI, and I'm lazy. But mostly, I don't think adding them now actually helps achieve anything. Being able to check if the class has specialised methods is useful: if ($pdo instanceof PDOSqlite) { $pdo->loadExtension(...); // do fun stuff with extension here. } But for the classes that have no specialised method: if ($pdo instanceof PDOMysql) { // What would be of utility here? } cheers Dan Ack * How to value being consistent is an aesthetic choice that many other programmers disagree with me on; "The fundamental guiding force to bear in mind is whether something is useful or not. Consistency might satisfy a personal desire for order and simplicity, but most of the time just having things be consistent is a lower priority than making choices that are useful." or in this case, less code to write and maintain.