pdo_firebird: "RETURNING" patch (Bug #43246)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux