Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43776 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68829 invoked from network); 26 Apr 2009 07:47:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2009 07:47:22 -0000 Authentication-Results: pb1.pair.com header.from=schwern@pobox.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=schwern@pobox.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain pobox.com designates 207.106.133.19 as permitted sender) X-PHP-List-Original-Sender: schwern@pobox.com X-Host-Fingerprint: 207.106.133.19 a-sasl-fastnet.sasl.smtp.pobox.com Solaris 10 (beta) Received: from [207.106.133.19] ([207.106.133.19:50536] helo=sasl.smtp.pobox.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/41-61418-38114F94 for ; Sun, 26 Apr 2009 03:47:21 -0400 Received: from localhost.localdomain (unknown [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 58278AD88D; Sun, 26 Apr 2009 03:47:13 -0400 (EDT) Received: from [10.23.42.2] (unknown [69.64.236.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 4551FAD88C; Sun, 26 Apr 2009 03:47:04 -0400 (EDT) Message-ID: <49F41176.8010508@pobox.com> Date: Sun, 26 Apr 2009 00:47:02 -0700 User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Andrey Hristov CC: internals@lists.php.net, Georg Richter , Andrey Hristov References: <49F3E835.6060009@pobox.com> <49F40A8A.1080305@hristov.com> In-Reply-To: <49F40A8A.1080305@hristov.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pobox-Relay-ID: 7495C6AA-3236-11DE-8FDD-C121C5FC92D5-02258300!a-sasl-fastnet.pobox.com Subject: Re: [PATCH] mysqli #35203 / #48065 Eliminate special case for calling procedures in mysqli From: schwern@pobox.com (Michael G Schwern) Andrey Hristov wrote: > 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). Sorry, I don't understand what you're asking. There is no changes to the mysqli API in this patch, its just a bug fix for mysqli::query(). If you're asking for a demonstration of the bug, there's a phpt test in the patch and demo code in the bugs. http://bugs.php.net/bug.php?id=35203 http://bugs.php.net/bug.php?id=48065 Here's a stand alone demo of the problem this patch is fixing. query("DROP PROCEDURE IF EXISTS test_bug"); $mysqli->query(" CREATE PROCEDURE test_bug() BEGIN $sql; END "); print $mysqli->error; } // Get a database connection. // Assumes a running MySQL 5 server on localhost with // a test account and database (no password) which can // drop and create procedures. function connection() { return new mysqli("localhost", "test", "", "test"); } // Using query() to call two stored procedures using query() // will fail with "Commands out of sync" function test_double_query($query) { $mysqli = connection(); if( !$mysqli->query($query) ) printf("First query FAILED: %s\n", $mysqli->error); if( !$mysqli->query($query) ) printf("Second query FAILED: %s\n", $mysqli->error); printf("ok - $query\n\n"); } setup_database(); // querying using statements or a procedure which contains // the same statement should work the same. It doesn't. test_double_query("call test_bug"); test_double_query(stmt()); ?> -- The interface should be as clean as newly fallen snow and its behavior as explicit as Japanese eel porn.