Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33102 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26584 invoked by uid 1010); 12 Nov 2007 23:21:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 26569 invoked from network); 12 Nov 2007 23:21:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Nov 2007 23:21:02 -0000 X-Host-Fingerprint: 84.75.68.140 84-75-68-140.dclient.hispeed.ch Received: from [84.75.68.140] ([84.75.68.140:22339] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/58-09095-DDFD8374 for ; Mon, 12 Nov 2007 18:21:02 -0500 Message-ID: <34.58.09095.DDFD8374@pb1.pair.com> To: internals@lists.php.net Date: Tue, 13 Nov 2007 00:20:57 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060400000303010204020500" X-Posted-By: 84.75.68.140 Subject: pdo_firebird: "RETURNING" queries/closeCursor (#43246/43271) From: hp@oeri.ch (Hans-Peter Oeri) --------------060400000303010204020500 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi! According to the archive, this might be the list for concrete diffs - if not, please excuse me. I tried pdo_firebird (CVS PHP_5_3) and quickly ran across to bugs: a) RETURNING queries fail pdo_firebird - against the published docs - wants to return stored procedure return values by the "execute" call. As it is, RETURNING queries (for the lower level library) go in the same bucket; big nono. My proposed change removes "special" handling of stored procedure calls alltogether - as it seems not only undocumented, but against the docs. As a "side effect", RETURNING queries work again. b) PDOStatement->closeCursor not implemented Whenever I tried to re-use a prepared statement, I got an error msg about reusing an open cursor. As it seems, mere cursor closing is not currently implemented (discarding the statement closes the cursor). My proposed change adds a minimal "cursor_closer". Please excuse form and/or function of my diffs (or human language mistake). I'm neither a C nor a PHP guru. Nevertheless I humbly present those for your consideration. HPO --------------060400000303010204020500 Content-Type: text/plain; name="pdo_firebird_RETURNING.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pdo_firebird_RETURNING.diff" diff -u php5-orig/ext/pdo_firebird/firebird_statement.c php5/ext/pdo_firebird/firebird_statement.c --- php5-orig/ext/pdo_firebird/firebird_statement.c 2007-11-12 16:59:34.000000000 +0100 +++ php5/ext/pdo_firebird/firebird_statement.c 2007-11-12 16:58:46.000000000 +0100 @@ -99,11 +99,15 @@ /* assume all params have been bound */ +#if 0 if ((S->statement_type == isc_info_sql_stmt_exec_procedure && isc_dsql_execute2(H->isc_status, &H->tr, &S->stmt, PDO_FB_SQLDA_VERSION, S->in_sqlda, &S->out_sqlda)) || isc_dsql_execute(H->isc_status, &H->tr, &S->stmt, PDO_FB_SQLDA_VERSION, S->in_sqlda)) { +#else + if (isc_dsql_execute(H->isc_status, &H->tr, &S->stmt, PDO_FB_SQLDA_VERSION, S->in_sqlda)) { +#endif break; } @@ -138,9 +142,11 @@ /* an EXECUTE PROCEDURE statement can be fetched from once, without calling the API, because * the result was returned in the execute call */ +#if 0 if (S->statement_type == isc_info_sql_stmt_exec_procedure) { S->exhausted = 1; } else { +#endif if (isc_dsql_fetch(H->isc_status, &S->stmt, PDO_FB_SQLDA_VERSION, &S->out_sqlda)) { if (H->isc_status[0] && H->isc_status[1]) { RECORD_ERROR(stmt); @@ -148,7 +154,9 @@ S->exhausted = 1; return 0; } +#if 0 } +#endif return 1; } return 0; --------------060400000303010204020500 Content-Type: text/plain; name="pdo_firebird_statement_closer.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pdo_firebird_statement_closer.diff" --- php5-orig/ext/pdo_firebird/firebird_statement.c 2007-11-12 21:54:13.000000000 +0100 +++ php5/ext/pdo_firebird/firebird_statement.c 2007-11-12 21:51:03.000000000 +0100 @@ -621,6 +620,22 @@ } /* }}} */ +static int firebird_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ +{ + pdo_firebird_stmt *S = (pdo_firebird_stmt*)stmt->driver_data; + int result = 1; + + /* close the statement */ + if (isc_dsql_free_statement(S->H->isc_status, &S->stmt, DSQL_close)) { + RECORD_ERROR(stmt); + result = 0; + } + + return result; +} +/* }}} */ + + struct pdo_stmt_methods firebird_stmt_methods = { /* {{{ */ firebird_stmt_dtor, firebird_stmt_execute, @@ -629,7 +644,10 @@ firebird_stmt_get_col, firebird_stmt_param_hook, firebird_stmt_set_attribute, - firebird_stmt_get_attribute + firebird_stmt_get_attribute, + NULL, + NULL, + firebird_stmt_cursor_closer }; /* }}} */ --------------060400000303010204020500--