pdo_firebird: "RETURNING" patch (Bug #43246)

pdo_firebird: "RETURNING" patch (Bug #43246)

am 12.11.2007 17:19:25 von Hans-Peter Oeri

--------------080909090604000605050605
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi!

I have bug #43246 open and just posted a "patch comment" there. As I
don't know how to (or cannot) upload patches in the bug system.

The problem is:
Queries ending in "RETURNING ..." get qualified as stored procedure
calls. Contrary to the docs, the PDOStatement->execute call is returning
the stored procedure's return value...

Just eliminating this undocumented behaviour clears the problem!

As I don't assume authority in php internals, the attached patch
(against CVS PHP_5_3) only "out-ifdefs" the "corrupt" parts.

Greets
HPO

--------------080909090604000605050605
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;


--------------080909090604000605050605
Content-Type: text/plain; charset=us-ascii

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------080909090604000605050605--