abies Fri Nov 14 05:38:42 2003 EDT Modified files: (Branch: PHP_4_3) /php-src/ext/interbase interbase.c Log: Fix the fix [ibase_trans()] Index: php-src/ext/interbase/interbase.c diff -u php-src/ext/interbase/interbase.c:1.91.2.23 php-src/ext/interbase/interbase.c:1.91.2.24 --- php-src/ext/interbase/interbase.c:1.91.2.23 Tue Nov 11 22:05:23 2003 +++ php-src/ext/interbase/interbase.c Fri Nov 14 05:38:41 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interbase.c,v 1.91.2.23 2003/11/12 03:05:23 iliaa Exp $ */ +/* $Id: interbase.c,v 1.91.2.24 2003/11/14 10:38:41 abies Exp $ */ /* TODO: Arrays, roles? @@ -624,7 +624,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "Interbase Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.91.2.23 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.91.2.24 $"); #ifdef COMPILE_DL_INTERBASE php_info_print_table_row(2, "Dynamic Module", "yes"); #endif @@ -1411,13 +1411,13 @@ XSQLDA *in_sqlda = NULL, *out_sqlda = NULL; BIND_BUF *bind_buf = NULL; int rv = FAILURE; - + IB_RESULT = NULL; if (argc > 0 && args != NULL) { SEPARATE_ZVAL(args); } - + /* allocate sqlda and output buffers */ if (ib_query->out_sqlda) { /* output variables in select, select for update */ IBDEBUG("Query wants XSQLDA for output"); @@ -1493,13 +1493,11 @@ zval ***args; char tpb[20], *tpbp = NULL; long trans_argl = 0; - int tpb_len = 0, argn, link_id = 0, trans_n = 0, i; + int tpb_len = 0, argn, link_id, trans_n = 0; ibase_db_link *ib_link; ibase_tr_link *ib_trans; - - RESET_ERRMSG; - link_id = IBG(default_link); + RESET_ERRMSG; /* TODO: multi-databases trans */ argn = ZEND_NUM_ARGS(); @@ -1516,9 +1514,9 @@ /* Handle all database links, although we don't support multibase transactions yet, so only the last one is will be used. */ - for (i = argn-1; i > 0 && Z_TYPE_PP(args[i]) == IS_RESOURCE; i--) { - ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, args[i], -1, "InterBase link", le_link, le_plink); - link_id = Z_LVAL_PP(args[i]); + if (argn > 1) { + ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, args[argn-1], -1, "InterBase link", le_link, le_plink); + link_id = Z_LVAL_PP(args[argn-1]); } /* First argument is transaction parameters */ @@ -1528,7 +1526,8 @@ efree(args); } - if (!link_id) { + if (argn < 2) { + link_id = IBG(default_link); ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, link_id, "InterBase link", le_link, le_plink); } @@ -1547,8 +1546,8 @@ if (trans_argl & PHP_IBASE_REC_VERSION) { tpb[tpb_len++] = isc_tpb_rec_version; }else{ - tpb[tpb_len++] = isc_tpb_no_rec_version; /* default in read_committed */ - } + tpb[tpb_len++] = isc_tpb_no_rec_version; /* default in read_committed */ + } } else if (trans_argl & PHP_IBASE_CONSISTENCY) { tpb[tpb_len++] = isc_tpb_consistency; } else {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php