Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43774 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63639 invoked from network); 26 Apr 2009 07:17:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2009 07:17:40 -0000 Authentication-Results: pb1.pair.com header.from=php@hristov.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@hristov.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hristov.com from 85.92.87.36 cause and error) X-PHP-List-Original-Sender: php@hristov.com X-Host-Fingerprint: 85.92.87.36 iko.gotobg.net Linux 2.6 Received: from [85.92.87.36] ([85.92.87.36:36792] helo=iko.gotobg.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5F/30-61418-29A04F94 for ; Sun, 26 Apr 2009 03:17:39 -0400 Received: from 75-166-173-241.hlrn.qwest.net ([75.166.173.241] helo=[192.168.100.132]) by iko.gotobg.net with esmtpa (Exim 4.69) (envelope-from ) id 1Lxyc8-00082f-Qo; Sun, 26 Apr 2009 10:17:25 +0300 Message-ID: <49F40A8A.1080305@hristov.com> Date: Sun, 26 Apr 2009 09:17:30 +0200 User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: Michael G Schwern CC: internals@lists.php.net, Georg Richter , Andrey Hristov References: <49F3E835.6060009@pobox.com> In-Reply-To: <49F3E835.6060009@pobox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - iko.gotobg.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - hristov.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PATCH] mysqli #35203 / #48065 Eliminate special case for calling procedures in mysqli From: php@hristov.com (Andrey Hristov) Hi, could you show how you want to express that in PHP code that will work with calling prepared statements. How the API should work? (Example PHP code that uses the new API). Best, Andrey 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 > >