lwe Mon Nov 19 21:55:30 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/pdo_firebird firebird_statement.c Log: - Fixed bug #43246 (firebird: INSERT ... RETURNING ... throws exception) #Reworked cursor_open/cursor_close #Only using isc_dsl_execute() (as in ext/interbase) Thanks to Hans-Peter Oeri for providing this patch http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_firebird/firebird_statement.c?r1=1.18.2.1.2.5.2.7&r2=1.18.2.1.2.5.2.8&diff_format=u Index: php-src/ext/pdo_firebird/firebird_statement.c diff -u php-src/ext/pdo_firebird/firebird_statement.c:1.18.2.1.2.5.2.7 php-src/ext/pdo_firebird/firebird_statement.c:1.18.2.1.2.5.2.8 --- php-src/ext/pdo_firebird/firebird_statement.c:1.18.2.1.2.5.2.7 Fri Nov 16 12:27:49 2007 +++ php-src/ext/pdo_firebird/firebird_statement.c Mon Nov 19 21:55:30 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: firebird_statement.c,v 1.18.2.1.2.5.2.7 2007/11/16 12:27:49 lwe Exp $ */ +/* $Id: firebird_statement.c,v 1.18.2.1.2.5.2.8 2007/11/19 21:55:30 lwe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -99,11 +99,7 @@ S->cursor_open = 0; /* assume all params have been bound */ - 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)) { + if (isc_dsql_execute(H->isc_status, &H->tr, &S->stmt, PDO_FB_SQLDA_VERSION, S->in_sqlda)) { break; } @@ -113,8 +109,8 @@ } *S->name = 0; - S->cursor_open = 1; - S->exhausted = 0; + S->cursor_open = (S->out_sqlda.sqln > 0); /* A cursor is opened, when more than zero columns returned */ + S->exhausted = !S->cursor_open; return 1; } while (0); @@ -136,20 +132,16 @@ strcpy(stmt->error_code, "HY000"); H->last_app_error = "Cannot fetch from a closed cursor"; } else if (!S->exhausted) { - - /* an EXECUTE PROCEDURE statement can be fetched from once, without calling the API, because - * the result was returned in the execute call */ - if (S->statement_type == isc_info_sql_stmt_exec_procedure) { - S->exhausted = 1; - } else { - 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); - } - S->exhausted = 1; - return 0; + 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); } + S->exhausted = 1; + return 0; } + if (S->statement_type == isc_info_sql_stmt_exec_procedure) { + S->exhausted = 1; + } return 1; } return 0;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php