CVS update: php3/functions

From: Date: Fri, 30 Apr 1999 09:49:23 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5297@lists.php.net to get a copy of this message
Date: Friday April 30, 1999 @ 5:49 Author: thies Update of /repository/php3/functions In directory php:/tmp/cvs-serv16859/functions Modified Files: oracle.c oracle.h Log Message: see changelog: most of the cursors will now get closed with the connection, as we cannot call hash_apply for "list" while we're already in "shutdown" mode (after re-reading, i don't understand myself;-) Index: php3/functions/oracle.c diff -u php3/functions/oracle.c:1.101 php3/functions/oracle.c:1.102 --- php3/functions/oracle.c:1.101 Sun Apr 25 13:00:21 1999 +++ php3/functions/oracle.c Fri Apr 30 05:49:23 1999 @@ -30,7 +30,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oracle.c,v 1.101 1999/04/25 17:00:21 thies Exp $ */ +/* $Id: oracle.c,v 1.102 1999/04/30 09:49:23 thies Exp $ */ #if defined(COMPILE_DL) # if PHP_31 @@ -94,9 +94,9 @@ static char *ora_error(Cda_Def *); static int ora_describe_define(oraCursor *); static int _cursors_cleanup(list_entry *le); -static void _close_oraconn(oraConnection *conn); -static void _close_orapconn(oraConnection *conn); -static void _close_oracur(oraCursor *cur); +static int _close_oraconn(oraConnection *conn); +static int _close_orapconn(oraConnection *conn); +static int _close_oracur(oraCursor *cur); static int _ora_ping(oraConnection *conn); int ora_set_param_values(oraCursor *cursor, int isout); @@ -135,7 +135,7 @@ php3_minit_oracle, php3_mshutdown_oracle, php3_rinit_oracle, - NULL, + php3_rshutdown_oracle, php3_info_oracle, STANDARD_MODULE_PROPERTIES }; @@ -179,6 +179,7 @@ DLEXPORT php3_module_entry *get_module() { return &oracle_module_entry; }; #endif +#if 0 static int _cursors_cleanup(list_entry *le) { ORACLE_TLS_VARS; @@ -187,39 +188,58 @@ oraCursor *curs = ((oraCursor *) le->ptr); oraConnection *conn = curs->conn_ptr; + if (! conn->open) + return 1; + + /* if ((!(conn->open)) && (curs->open > 0)){ oclose(&curs->cda); curs->open = 0; } + */ + + return 1; } + return 0; } +#endif -static void _close_oraconn(oraConnection *conn) +static int _close_oraconn(oraConnection *conn) { - ORACLE_TLS_VARS; - - conn->open = 0; - _php3_hash_apply(ORACLE_GLOBAL(php3_oracle_module).resource_list, - (int (*)(void *))_cursors_cleanup); - - ologof(&conn->lda); - ORACLE_GLOBAL(php3_oracle_module).num_links--; - efree(conn); + ORACLE_TLS_VARS; + + conn->open = 0; + + /* zeev says, this is a no-no (thies 990430) + _php3_hash_apply(ORACLE_GLOBAL(php3_oracle_module).resource_list, + (int (*)(void *))_cursors_cleanup); + */ + + ologof(&conn->lda); + ORACLE_GLOBAL(php3_oracle_module).num_links--; + efree(conn); + + return 1; } -static void _close_orapconn(oraConnection *conn) +static int _close_orapconn(oraConnection *conn) { - ORACLE_TLS_VARS; - - conn->open = 0; - _php3_hash_apply(ORACLE_GLOBAL(php3_oracle_module).resource_plist, - (int (*)(void *))_cursors_cleanup); + ORACLE_TLS_VARS; - ologof(&conn->lda); - free(conn); - ORACLE_GLOBAL(php3_oracle_module).num_links--; - ORACLE_GLOBAL(php3_oracle_module).num_persistent--; + conn->open = 0; + + /* zeev says, this is a no-no (thies 990430) + _php3_hash_apply(ORACLE_GLOBAL(php3_oracle_module).resource_plist, + (int (*)(void *))_cursors_cleanup); + */ + + ologof(&conn->lda); + free(conn); + ORACLE_GLOBAL(php3_oracle_module).num_links--; + ORACLE_GLOBAL(php3_oracle_module).num_persistent--; + + return 1; } static int @@ -236,7 +256,7 @@ } -static void _close_oracur(oraCursor *cur) +static int _close_oracur(oraCursor *cur) { int i; @@ -261,8 +281,10 @@ oclose(&cur->cda); cur->open = 0; } - efree(cur); + efree(cur); } + + return 1; } int php3_minit_oracle(INIT_FUNC_ARGS) @@ -341,9 +363,10 @@ } -int php3_mshutdown_oracle(void) +int php3_mshutdown_oracle(SHUTDOWN_FUNC_ARGS) { ORACLE_TLS_VARS; + #ifdef THREAD_SAFE PHP3_TLS_THREAD_FREE(oracle_globals); PHP3_MUTEX_LOCK(oracle_mutex); @@ -356,6 +379,14 @@ } PHP3_MUTEX_UNLOCK(oracle_mutex); #endif + return SUCCESS; + +} + +int php3_rshutdown_oracle(SHUTDOWN_FUNC_ARGS) +{ + ORACLE_TLS_VARS; + return SUCCESS; } Index: php3/functions/oracle.h diff -u php3/functions/oracle.h:1.36 php3/functions/oracle.h:1.37 --- php3/functions/oracle.h:1.36 Sun Apr 25 12:26:41 1999 +++ php3/functions/oracle.h Fri Apr 30 05:49:23 1999 @@ -1,4 +1,4 @@ -/* $Id: oracle.h,v 1.36 1999/04/25 16:26:41 thies Exp $ */ +/* $Id: oracle.h,v 1.37 1999/04/30 09:49:23 thies Exp $ */ #ifndef _PHP3_ORACLE_H #define _PHP3_ORACLE_H @@ -134,7 +134,8 @@ extern void php3_Ora_Parse(INTERNAL_FUNCTION_PARAMETERS); extern void php3_Ora_Rollback(INTERNAL_FUNCTION_PARAMETERS); extern int php3_minit_oracle(INIT_FUNC_ARGS); -extern int php3_mshutdown_oracle(void); +extern int php3_mshutdown_oracle(SHUTDOWN_FUNC_ARGS); +extern int php3_rshutdown_oracle(SHUTDOWN_FUNC_ARGS); extern void php3_info_oracle(void); extern int php3_rinit_oracle(INIT_FUNC_ARGS); -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5297) next »