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
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;
--- 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
 };
 /* }}} */

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to