Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15929 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47469 invoked by uid 1010); 9 Apr 2005 14:33:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 47452 invoked from network); 9 Apr 2005 14:33:35 -0000 Received: from unknown (HELO gmail.com) (127.0.0.1) by localhost with SMTP; 9 Apr 2005 14:33:35 -0000 X-Host-Fingerprint: 64.233.170.195 rproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.170.195:32876] helo=rproxy.gmail.com) by pb1.pair.com (ecelerity HEAD r(5268)) with SMTP id DC/3F-19272-FB7E7524 for ; Sat, 09 Apr 2005 10:33:35 -0400 Received: by rproxy.gmail.com with SMTP id i8so828105rne for ; Sat, 09 Apr 2005 07:33:32 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=U/6x1vOJDd0xuyTeVWCgolXEaKw7q54XccP6ExePHlSPJB3S2zJaTg5jtrdZIHz/9lQpz9YOsOJm/65Hfml+z3wK+S7LotvM3yVvn1sxFvSKpQbJ54gpwwKP/PB/4xtg0OWeg8xqGz1ZOUSkDo5lj7hEmne1EpyoNnH30wqovEw= Received: by 10.39.3.56 with SMTP id f56mr1222862rni; Sat, 09 Apr 2005 07:33:32 -0700 (PDT) Received: by 10.38.65.30 with HTTP; Sat, 9 Apr 2005 07:33:32 -0700 (PDT) Message-ID: Date: Sat, 9 Apr 2005 10:33:32 -0400 Reply-To: Dan Scott To: internals@lists.php.net Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: PDO proposal: add PDOStatement::nextResult() method to support stored procedures From: denials@gmail.com (Dan Scott) Wez et al: I've been writing a chapter on database programming with PHP, using PDO, and ran across a scenario that has not yet been fulfilled by the PDO API. Many databases (Apache Derby, DB2, Microsoft SQL Server, MySQL 5, and PostgreSQL to a certain extent) support stored procedures that can return multiple result sets. Database APIs typically set the result set pointer to the first row of the first result set returned, allow the application to iterate through the rows, and provide some method to request the second result set from the database server. In ODBC, for example, you would call SQLFetch() to iterate through the rows of the first result set, then call SQLNextResult() to request the next result set. In the PHP realm, Unified ODBC defines odbc_next_result(); mssql defines mssql_next_result(); PEAR::DB defines DB_Result:nextResult(). PDO, however, currently provides no means of working with the second or subsequent result sets returned from a call to a stored procedure. To build on the established naming practice from existing database extensions, I propose that the PDO interface define the standard method: /* {{{ proto bool PDOStatement::nextResult(void) Requests the next result set from the database */ Thanks, Dan Note: somewhat confusingly, mysqli defines mysqli_next_result(), but this is used to retrieve the results of a multi-query... a very different thing, and not something I advocate adding to PDO. They might have trouble disambiguating that from the stored procedure case when MySQL 5 reaches production status.