cvs: php4 /ext/oci8 oci8.c php_oci8.h

From: Date: Sun, 10 Feb 2002 12:41:52 +0000
Subject: cvs: php4 /ext/oci8 oci8.c php_oci8.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9334@lists.php.net to get a copy of this message
thies Sun Feb 10 07:41:52 2002 EDT Modified files: /php4/ext/oci8 oci8.c php_oci8.h Log: only rollback at script end if there is something to rollback. Index: php4/ext/oci8/oci8.c diff -u php4/ext/oci8/oci8.c:1.167 php4/ext/oci8/oci8.c:1.168 --- php4/ext/oci8/oci8.c:1.167 Fri Feb 8 13:50:12 2002 +++ php4/ext/oci8/oci8.c Sun Feb 10 07:41:52 2002 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oci8.c,v 1.167 2002/02/08 18:50:12 thies Exp $ */ +/* $Id: oci8.c,v 1.168 2002/02/10 12:41:52 thies Exp $ */ /* TODO list: * @@ -39,7 +39,6 @@ * - have one ocifree() call. * - make it possible to have persistent statements? * - implement connection pooling in ZTS mode. - * - implement automatic commit *OR* rollback on script end * - failover * - change all the lob stuff to work without classes (optional)! * - make sure that the callbacks terminate the strings with \0 @@ -51,7 +50,6 @@ * - add Collection iterator object for INDEX BY tables * - make auto-rollabck only happen if we have an outstanding transaction * - implement ocidisconnect - * - add bind patch */ /* {{{ includes & stuff */ @@ -633,7 +631,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "OCI8 Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.167 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.168 $"); #ifndef PHP_WIN32 php_info_print_table_row(2, "Oracle Version", PHP_OCI8_VERSION ); php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR ); @@ -804,13 +802,20 @@ oci_debug("START _oci_conn_list_dtor: id=%d",connection->id); if (connection->pServiceContext) { - CALL_OCI_RETURN(connection->error,OCITransRollback( - connection->pServiceContext, - connection->pError, - (ub4)0)); - - if (connection->error) { - oci_error(connection->pError, "failed to rollback outstanding transactions!", connection->error); + + if (connection->needs_commit) { + oci_debug("OCITransRollback"); + CALL_OCI_RETURN(connection->error,OCITransRollback( + connection->pServiceContext, + connection->pError, + (ub4)0)); + + if (connection->error) { + oci_error(connection->pError, "failed to rollback outstanding transactions!", connection->error); + } + connection->needs_commit = 0; + } else { + oci_debug("nothing to do.."); } CALL_OCI(OCIHandleFree( @@ -1461,6 +1466,7 @@ mode)); statement->error = oci_error(statement->pError, "OCIStmtExecute", error); + if (statement->binds) { zend_hash_apply(statement->binds, (apply_func_t) _oci_bind_post_exec TSRMLS_CC); } @@ -1470,6 +1476,12 @@ if (statement->error) { return 0; } + + if (mode & OCI_COMMIT_ON_SUCCESS) { + statement->conn->needs_commit = 0; + } else { + statement->conn->needs_commit = 1; + } } if ((statement->stmttype == OCI_STMT_SELECT) && (statement->executed == 0)) { @@ -3523,11 +3535,17 @@ OCI_GET_CONN(connection,conn); + oci_debug("<OCITransRollback"); + CALL_OCI_RETURN(connection->error, OCITransRollback( connection->pServiceContext, connection->pError, (ub4) 0)); + connection->needs_commit = 0; + + oci_debug(">OCITransRollback"); + if (connection->error) { oci_error(connection->pError, "OCIRollback", connection->error); oci_handle_error(connection, connection->error); @@ -3559,6 +3577,8 @@ connection->pServiceContext, connection->pError, (ub4) 0)); + + connection->needs_commit = 0; oci_debug(">OCITransCommit"); Index: php4/ext/oci8/php_oci8.h diff -u php4/ext/oci8/php_oci8.h:1.22 php4/ext/oci8/php_oci8.h:1.23 --- php4/ext/oci8/php_oci8.h:1.22 Fri Feb 8 13:50:12 2002 +++ php4/ext/oci8/php_oci8.h Sun Feb 10 07:41:52 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_oci8.h,v 1.22 2002/02/08 18:50:12 thies Exp $ */ +/* $Id: php_oci8.h,v 1.23 2002/02/10 12:41:52 thies Exp $ */ #if HAVE_OCI8 # ifndef PHP_OCI8_H @@ -79,6 +79,7 @@ OCISvcCtx *pServiceContext; sword error; OCIError *pError; + int needs_commit; } oci_connection; typedef struct {

« previous php.cvs (#9334) next »