Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107858 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 95878 invoked from network); 26 Nov 2019 01:46:49 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 26 Nov 2019 01:46:49 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 6C5572D214B for ; Mon, 25 Nov 2019 15:41:20 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Mon, 25 Nov 2019 15:41:16 -0800 (PST) Received: by mail-io1-xd32.google.com with SMTP id i11so18299984iol.13 for ; Mon, 25 Nov 2019 15:41:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xKmDXtDs7LJ6CN0a3Txn7ejUqvfjdpQ9AmYeleyQn1c=; b=jemxTX2grFbB/zgrVI+Qml155Sn1eHiISoITvJG1HgSwKK9wbqMn6dLfz0hmKiWz1k /pIO9Xi0LtE26JVQmejSAc8RADrfq03SGlrb8jr8IPPonFZgaw9+P68y1s+6PILnqKxW Ks/3Yz3vPNCmNB0dl7Y8oegTRiWwRKJ9WrYNhZngtcFLlP2dvwKHScy+FOa1XA4QpUqh mSrHit+0aHrYj2JfyZeUdKn0Mfemcan5607BvlvIVo9oGK6mCu2oTo1SV85AWNkVMLtV muNlobRMTj+y6/wzZIKdk/5wOk5ydhtk+IoVLYolHkaxgyj7cEZheriJluMat8AAiAsT cNHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xKmDXtDs7LJ6CN0a3Txn7ejUqvfjdpQ9AmYeleyQn1c=; b=px6q4FfU/+KwaS2JxLSJIjX4V/rbnjZwmplITwZUvJCMWpIIjMU8ibMjkKw0DyjhHV WcCKhKY9YX+eIrRp+apUFa59UYuRWNEE1sCcwjAAxxDn/GUeSg576lFenQPL4DgLzDmm Y3ZTBo3ab/2bJyqo4UPyvpLZCKcky2mU8nOXSx5wqnnm5nkvyoITfQHZ34sfD4ta3+KQ QBL+MM5/Srii6ZEPDjxJ4s2jcR7IV6w4hVRwHtc4vWa2/qSGzGjY3xSVVOuifVop6xdh uMSG2IVRFOZNiDI2WXi9nGNnVBlC0hRk14riOVGb+T+zJ8fPg3U86xSr5nrR8XoDn7iy +IzA== X-Gm-Message-State: APjAAAVxY3vqIxow2b0RfhtGU+pyYAaQzlIekUsNBztD9yKYg8tLwNZt W2BFf0ssg3Bc1bhyYJb9oOJH59ymX3ZY2cjiyfk= X-Google-Smtp-Source: APXvYqzTtZtNhD8zccHeg/2MWomCD2mCZCkJ2matGxJ8PEbm47udcr7D90YHUd3SSe/HfbRb78gBdAH/T+GKohaCq2w= X-Received: by 2002:a6b:710f:: with SMTP id q15mr2067609iog.103.1574725276089; Mon, 25 Nov 2019 15:41:16 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 26 Nov 2019 01:41:05 +0200 Message-ID: To: Joel Hutchinson Cc: "internals@lists.php.net" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Envelope-From: Subject: Re: [PHP-DEV] mysqli needs a method to bind a single parameter From: weirdan@gmail.com (Bruce Weirdan) On Mon, Nov 25, 2019 at 8:06 PM Joel Hutchinson wrote: > This proposal would leave the previous mysqli_stmt_bind_param mostly unto= uched. Instead, the two could be used in tandem > $sql =3D 'SELECT name FROM db.customer WHERE record_id =3D ? AND shipping= _zip =3D ?'; > if(isset($_GET['zip'])) $sql .=3D ' AND billing_zip =3D ?'; > > $stmt =3D $db->prepare($sql); > $stmt->bind_param('is', $_GET['record_id'], $_GET['shipping_zip']); > if(isset($_GET['zip'])) $stmt->bind_single('s', $_GET['billing_zip'], 3); > $stmt->execute(); > This necessitates a small change to mysqli_stmt_bind_param, in that the c= urrent function has a parameter check to ensure that the number of binds ma= tches the number of parameters in the query (or else it emits an E_WARNING)= . That check would have to move to mysqli_stmt_execute, if it is still to b= e performed. If `bind_param` is allowed to do incomplete bind (as in your example where you supply 2 out of 3 required bound parameters) t hen there's no need for additional method, as you could simply do: if (isset($_GET['zip'])) $stmt->bind_param('s', $_GET['zip']); --=20 Best regards, Bruce Weirdan mailto:weirdan@gmai= l.com