Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43964 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55712 invoked from network); 14 May 2009 23:04:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 May 2009 23:04:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=schwern@pobox.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=schwern@pobox.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain pobox.com designates 208.72.237.25 as permitted sender) X-PHP-List-Original-Sender: schwern@pobox.com X-Host-Fingerprint: 208.72.237.25 a-sasl-quonix.sasl.smtp.pobox.com Solaris 10 (beta) Received: from [208.72.237.25] ([208.72.237.25:45118] helo=sasl.smtp.pobox.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/14-27038-473AC0A4 for ; Thu, 14 May 2009 19:04:21 -0400 Received: from localhost.localdomain (unknown [127.0.0.1]) by a-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id 77FB117E18; Thu, 14 May 2009 19:04:17 -0400 (EDT) Received: from windhund.local (unknown [173.11.4.145]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 9CCCF17E16; Thu, 14 May 2009 19:04:14 -0400 (EDT) Message-ID: <4A0CA36D.7020207@pobox.com> Date: Thu, 14 May 2009 16:04:13 -0700 User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: internals@lists.php.net CC: Georg Richter , Andrey Hristov References: <49F3E835.6060009@pobox.com> In-Reply-To: <49F3E835.6060009@pobox.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Pobox-Relay-ID: 8CF8B442-40DB-11DE-819C-D766E3C8547C-02258300!a-sasl-quonix.pobox.com Subject: Re: [PATCH] mysqli #35203 / #48065 Eliminate special case for calling procedures in mysqli From: schwern@pobox.com (Michael G Schwern) Ping? There's a fully formed patch here, with tests, to fix a mysqli bug. I haven't gotten any feedback. Here's the original message with the patch. http://news.php.net/php.internals/43773 Michael G Schwern wrote: > This is a patch against 5.2.9 to fix mysqli::query so a user can call stored > procedures the same as they do any other statement. No more multi_query() and > next_result() work arounds necessary to avoid a "Commands out of sync" error. > > I note this has been rejected several times in the tracker as not being a bug. > I feel its a clear encapsulation violation making the user special case a > query just because it's calling a stored procedure. Aside from just being > very inconvenient, some API wrappers around mysqli, Drupal 6 for example, > leave the user with no way to get at mysqli::multi_query(). > > Anyhow, here's a complete patch with a test. The technique and code is lifted > from Perl's DBD::mysql driver, which you can see here as > mysql_st_free_result_sets() > http://cpansearch.perl.org/src/CAPTTOFU/DBD-mysql-4.011/dbdimp.c > > Before each query it frees any results still hanging around on the connection, > which is essentially what a user has to do. I'm not really a C programmer so > I left most of the code as is, do/while loop and all. > > I'm not sure how mysqli normally handles errors so I just went with a printf() > and return trusting that you'll fix that up. It causes test 057 to fail > because that test deliberately generates an out of sync error, which my code > diligently prints. So that should go away with fixed error handling. > > Thanks, > Schwern > > -- ROCKS FALL! EVERYONE DIES! http://www.somethingpositive.net/sp05032002.shtml