[PATCH] OCI8 module - proposed patches (PART 2 of 2)
| From: | SQUILLACE MASSIMO | Date: | Mon, 07 Apr 2003 16:57:30 +0000 |
| Subject: | [PATCH] OCI8 module - proposed patches (PART 2 of 2) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-763@lists.php.net to get a copy of this message | ||
Here is the last half of the message, with the second attachment.
Massimo
? fourpatches.patch Index: oci8.c =================================================================== RCS file: /repository/php4/ext/oci8/oci8.c,v retrieving revision 1.205 diff -u -r1.205 oci8.c --- oci8.c 18 Mar 2003 12:06:00 -0000 1.205 +++ oci8.c 6 Apr 2003 16:57:21 -0000 @@ -59,6 +59,7 @@ #endif #include "php.h" +#include "php_ini.h" #include "ext/standard/info.h" /* #define HAVE_OCI8_TEMP_LOB 1 */ @@ -431,10 +432,19 @@ #endif /* }}} */ + +/* {{{ PHP_INI + */ +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY_EX("oci8.connection_timeout", "-1", PHP_INI_SYSTEM, OnUpdateInt, connection_timeout, php_oci_globals, oci_globals, display_link_numbers) + STD_PHP_INI_BOOLEAN("oci8.credentials_toupper", "0", PHP_INI_SYSTEM, OnUpdateBool, credentials_toupper, php_oci_globals, oci_globals) +PHP_INI_END() +/* }}} */ + /* {{{ startup, shutdown and info functions */ static void php_oci_init_globals(php_oci_globals *oci_globals_p TSRMLS_DC) -{ +{ OCI(shutdown) = 0; OCI(in_call) = 0; @@ -442,14 +452,14 @@ zend_hash_init(OCI(user), 13, NULL, NULL, 1); OCI(server) = malloc(sizeof(HashTable)); - zend_hash_init(OCI(server), 13, NULL, NULL, 1); + zend_hash_init(OCI(server), 13, NULL, NULL, 1); CALL_OCI(OCIEnvInit( - &OCI(pEnv), - OCI_DEFAULT, - 0, + &OCI(pEnv), + OCI_DEFAULT, + 0, NULL)); - + CALL_OCI(OCIHandleAlloc( OCI(pEnv), (dvoid **)&OCI(pError), @@ -495,6 +505,8 @@ php_oci_init_globals(&oci_globals TSRMLS_CC); #endif + REGISTER_INI_ENTRIES(); + le_stmt = zend_register_list_destructors_ex(_oci_stmt_list_dtor, NULL, "oci8 statement", module_number); le_conn = zend_register_list_destructors_ex(php_oci_free_conn_list, NULL, "oci8 connection", module_number); le_desc = zend_register_list_destructors_ex(_oci_descriptor_list_dtor, NULL, "oci8 descriptor", module_number); @@ -566,10 +578,26 @@ /* ----------------------------------------------------------------- */ +static int _session_rcleanup(oci_session *session TSRMLS_DC) +{ + if ((OCI(current_timestamp) - OCI(connection_timeout)) > session->server->timestamp) { + _oci_close_session(session); + } + return 0; +} + +static int _server_rcleanup(oci_server *server TSRMLS_DC) +{ + if ((OCI(current_timestamp) - OCI(connection_timeout)) > server->timestamp) { + _oci_close_server(server); + } + return 0; +} + PHP_RINIT_FUNCTION(oci) { /* XXX NYI - OCI(num_links) = + OCI(num_links) = OCI(num_persistent); */ @@ -578,6 +606,13 @@ oci_debug("php_rinit_oci"); + /* close all timed out connections (if check is enabled) */ + if (-1 != OCI(connection_timeout)) { + OCI(current_timestamp) = time(NULL); + zend_hash_apply(OCI(user), (apply_func_t)_session_rcleanup TSRMLS_CC); + zend_hash_apply(OCI(server), (apply_func_t)_server_rcleanup TSRMLS_CC); + } + return SUCCESS; } @@ -597,6 +632,8 @@ PHP_MSHUTDOWN_FUNCTION(oci) { + UNREGISTER_INI_ENTRIES(); + OCI(shutdown) = 1; oci_debug("START php_mshutdown_oci"); @@ -611,7 +648,7 @@ free(OCI(server)); CALL_OCI(OCIHandleFree( - (dvoid *)OCI(pEnv), + (dvoid *)OCI(pEnv), OCI_HTYPE_ENV)); oci_debug("END php_mshutdown_oci"); @@ -649,6 +686,8 @@ #endif php_info_print_table_end(); + DISPLAY_INI_ENTRIES(); + } /* }}} */ @@ -844,7 +883,7 @@ if (connection->pError) { CALL_OCI(OCIHandleFree( - (dvoid *) connection->pError, + (dvoid *) connection->pError, (ub4) OCI_HTYPE_ERROR)); } @@ -2153,30 +2192,32 @@ oci_session *session = 0, *psession = 0; OCISvcCtx *svchp = 0; char *hashed_details; + struct timeval tv; + int sec, usec; #ifdef HAVE_OCI9 ub2 charsetid; #endif TSRMLS_FETCH(); - /* + /* check if we already have this user authenticated - we will reuse authenticated users within a request no matter if the user requested a persistent + we will reuse authenticated users within a request no matter if the user requested a persistent connections or not! - - but only as pesistent requested connections will be kept between requests! - */ - hashed_details = (char *) malloc(strlen(SAFE_STRING(username))+ - strlen(SAFE_STRING(password))+ - strlen(SAFE_STRING(server->dbname))+1); - - sprintf(hashed_details,"%s%s%s", - SAFE_STRING(username), - SAFE_STRING(password), - SAFE_STRING(server->dbname)); + but only as persistent requested connections will be kept between requests! + */ if (! exclusive) { + hashed_details = (char *) malloc(strlen(SAFE_STRING(username))+ + strlen(SAFE_STRING(password))+ + strlen(SAFE_STRING(server->dbname))+1); + + sprintf(hashed_details,"%s%s%s", + SAFE_STRING(username), + SAFE_STRING(password), + SAFE_STRING(server->dbname)); + zend_hash_find(OCI(user), hashed_details, strlen(hashed_details)+1, (void **) &session); if (session) { @@ -2191,6 +2232,14 @@ /* breakthru to open */ } } + } else { + gettimeofday((struct timeval *) &tv, (struct timezone *) NULL); + sec = (int) tv.tv_sec; + usec = (int) (tv.tv_usec % 1000000); + /* The max value usec can have is 0xF423F, so we use only five hex + digits for usec and eigth hex digits for sec. */ + hashed_details = (char *) malloc(8+5+1); /* always enough */ + sprintf(hashed_details, "%08x%05x", tv.tv_sec, tv.tv_usec); } session = calloc(1,sizeof(oci_session)); @@ -2217,16 +2266,16 @@ CALL_OCI_RETURN(charsetid, OCINlsCharSetNameToId( OCI(pEnv), charset)); - + session->charsetId = charsetid; oci_debug("oci_do_connect: using charset id=%d",charsetid); } - + /* create an environment using the character set id, Oracle 9i+ ONLY */ CALL_OCI(OCIEnvNlsCreate( &session->pEnv, - OCI_DEFAULT, - 0, + OCI_DEFAULT, + 0, NULL, NULL, NULL, @@ -2245,12 +2294,12 @@ /* allocate temporary Service Context */ CALL_OCI_RETURN(OCI(error), OCIHandleAlloc( - session->pEnv, - (dvoid **)&svchp, - OCI_HTYPE_SVCCTX, - 0, + session->pEnv, + (dvoid **)&svchp, + OCI_HTYPE_SVCCTX, + 0, NULL)); - + if (OCI(error) != OCI_SUCCESS) { oci_error(OCI(pError), "_oci_open_session: OCIHandleAlloc OCI_HTYPE_SVCCTX", OCI(error)); goto CLEANUP; @@ -2258,10 +2307,10 @@ /* allocate private session-handle */ CALL_OCI_RETURN(OCI(error), OCIHandleAlloc( - session->pEnv, - (dvoid **)&session->pSession, - OCI_HTYPE_SESSION, - 0, + session->pEnv, + (dvoid **)&session->pSession, + OCI_HTYPE_SESSION, + 0, NULL)); if (OCI(error) != OCI_SUCCESS) { @@ -2269,11 +2318,11 @@ goto CLEANUP; } - /* Set the server handle in service handle */ + /* Set the server handle in service handle */ CALL_OCI_RETURN(OCI(error), OCIAttrSet( - svchp, - OCI_HTYPE_SVCCTX, - server->pServer, + svchp, + OCI_HTYPE_SVCCTX, + server->pServer, 0, OCI_ATTR_SERVER, OCI(pError))); @@ -2285,11 +2334,11 @@ /* set the username in user handle */ CALL_OCI_RETURN(OCI(error), OCIAttrSet( - (dvoid *) session->pSession, - (ub4) OCI_HTYPE_SESSION, - (dvoid *) username, - (ub4) strlen(username), - (ub4) OCI_ATTR_USERNAME, + (dvoid *) session->pSession, + (ub4) OCI_HTYPE_SESSION, + (dvoid *) username, + (ub4) strlen(username), + (ub4) OCI_ATTR_USERNAME, OCI(pError))); if (OCI(error) != OCI_SUCCESS) { @@ -2299,11 +2348,11 @@ /* set the password in user handle */ CALL_OCI_RETURN(OCI(error), OCIAttrSet( - (dvoid *) session->pSession, - (ub4) OCI_HTYPE_SESSION, - (dvoid *) password, - (ub4) strlen(password), - (ub4) OCI_ATTR_PASSWORD, + (dvoid *) session->pSession, + (ub4) OCI_HTYPE_SESSION, + (dvoid *) password, + (ub4) strlen(password), + (ub4) OCI_ATTR_PASSWORD, OCI(pError))); if (OCI(error) != OCI_SUCCESS) { @@ -2312,10 +2361,10 @@ } CALL_OCI_RETURN(OCI(error), OCISessionBegin( - svchp, - OCI(pError), - session->pSession, - (ub4) OCI_CRED_RDBMS, + svchp, + OCI(pError), + session->pSession, + (ub4) OCI_CRED_RDBMS, (ub4) OCI_DEFAULT)); if (OCI(error) != OCI_SUCCESS) { @@ -2325,7 +2374,7 @@ /* Free Temporary Service Context */ CALL_OCI(OCIHandleFree( - (dvoid *) svchp, + (dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX)); if (exclusive) { @@ -2333,7 +2382,7 @@ } else { zend_hash_update(OCI(user), session->hashed_details, - strlen(session->hashed_details)+1, + strlen(session->hashed_details)+1, (void *)session, sizeof(oci_session), (void**)&psession); @@ -2627,7 +2676,8 @@ oci_server *server = 0; oci_session *session = 0; oci_connection *connection = 0; - + int i, len; + /* if a forth parameter is handed over, it is the charset identifier (but is only used in Oracle 9i+) */ if (zend_get_parameters_ex(4, &userParam, &passParam, &dbParam, &charParam) == SUCCESS) { convert_to_string_ex(userParam); @@ -2665,18 +2715,34 @@ goto CLEANUP; } + /* if enabled in php.ini, convert credentials to uppercase */ + if (OCI(credentials_toupper)) { + for (i = 0, len = strlen(SAFE_STRING(username)); i < len; i++) { + username[i] = toupper(username[i]); + } + for (i = 0, len = strlen(SAFE_STRING(password)); i < len; i++) { + password[i] = toupper(password[i]); + } + for (i = 0, len = strlen(SAFE_STRING(dbname)); i < len; i++) { + dbname[i] = toupper(dbname[i]); + } + } + server = _oci_open_server(dbname,persistent); if (! server) { goto CLEANUP; } + /* set/update server handle timestamp */ + server->timestamp = time(NULL); + if (exclusive) { /* exlusive session can never be persistent!*/ persistent = 0; } else { /* if our server-context is not persistent we can't */ - persistent = server->persistent; + persistent = (server->persistent) ? persistent : 0; } session = _oci_open_session(server,username,password,persistent,exclusive,charset); @@ -2690,10 +2756,10 @@ /* allocate our private error-handle */ CALL_OCI_RETURN(OCI(error), OCIHandleAlloc( - connection->session->pEnv, - (dvoid **)&connection->pError, - OCI_HTYPE_ERROR, - 0, + connection->session->pEnv, + (dvoid **)&connection->pError, + OCI_HTYPE_ERROR, + 0, NULL)); if (OCI(error) != OCI_SUCCESS) { Index: php_oci8.h =================================================================== RCS file: /repository/php4/ext/oci8/php_oci8.h,v retrieving revision 1.28 diff -u -r1.28 php_oci8.h --- php_oci8.h 18 Mar 2003 12:06:01 -0000 1.28 +++ php_oci8.h 6 Apr 2003 16:57:21 -0000 @@ -40,7 +40,7 @@ #define PHP_OCI_API __declspec(dllexport) #else #define PHP_OCI_API -#endif +#endif #if defined(min) #undef min @@ -55,6 +55,7 @@ int num; int persistent; int is_open; + time_t timestamp; char *dbname; OCIServer *pServer; #if 0 @@ -182,7 +183,11 @@ long num_links; */ - HashTable *server; + long connection_timeout; /* from php.ini */ + int credentials_toupper; /* from php.ini */ + time_t current_timestamp; /* set by PHP_RINIT_FUNCTION */ + + HashTable *server; HashTable *user; OCIEnv *pEnv;
? fourpatches.patch Index: oci8.c =================================================================== RCS file: /repository/php4/ext/oci8/oci8.c,v retrieving revision 1.205 diff -u -r1.205 oci8.c --- oci8.c 18 Mar 2003 12:06:00 -0000 1.205 +++ oci8.c 6 Apr 2003 16:57:21 -0000 @@ -59,6 +59,7 @@ #endif #include "php.h" +#include "php_ini.h" #include "ext/standard/info.h" /* #define HAVE_OCI8_TEMP_LOB 1 */ @@ -431,10 +432,19 @@ #endif /* }}} */ + +/* {{{ PHP_INI + */ +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY_EX("oci8.connection_timeout", "-1", PHP_INI_SYSTEM, OnUpdateInt, connection_timeout, php_oci_globals, oci_globals, display_link_numbers) + STD_PHP_INI_BOOLEAN("oci8.credentials_toupper", "0", PHP_INI_SYSTEM, OnUpdateBool, credentials_toupper, php_oci_globals, oci_globals) +PHP_INI_END() +/* }}} */ + /* {{{ startup, shutdown and info functions */ static void php_oci_init_globals(php_oci_globals *oci_globals_p TSRMLS_DC) -{ +{ OCI(shutdown) = 0; OCI(in_call) = 0; @@ -442,14 +452,14 @@ zend_hash_init(OCI(user), 13, NULL, NULL, 1); OCI(server) = malloc(sizeof(HashTable)); - zend_hash_init(OCI(server), 13, NULL, NULL, 1); + zend_hash_init(OCI(server), 13, NULL, NULL, 1); CALL_OCI(OCIEnvInit( - &OCI(pEnv), - OCI_DEFAULT, - 0, + &OCI(pEnv), + OCI_DEFAULT, + 0, NULL)); - + CALL_OCI(OCIHandleAlloc( OCI(pEnv), (dvoid **)&OCI(pError), @@ -495,6 +505,8 @@ php_oci_init_globals(&oci_globals TSRMLS_CC); #endif + REGISTER_INI_ENTRIES(); + le_stmt = zend_register_list_destructors_ex(_oci_stmt_list_dtor, NULL, "oci8 statement", module_number); le_conn = zend_register_list_destructors_ex(php_oci_free_conn_list, NULL, "oci8 connection", module_number); le_desc = zend_register_list_destructors_ex(_oci_descriptor_list_dtor, NULL, "oci8 descriptor", module_number); @@ -566,10 +578,26 @@ /* ----------------------------------------------------------------- */ +static int _session_rcleanup(oci_session *session TSRMLS_DC) +{ + if ((OCI(current_timestamp) - OCI(connection_timeout)) > session->server->timestamp) { + _oci_close_session(session); + } + return 0; +} + +static int _server_rcleanup(oci_server *server TSRMLS_DC) +{ + if ((OCI(current_timestamp) - OCI(connection_timeout)) > server->timestamp) { + _oci_close_server(server); + } + return 0; +} + PHP_RINIT_FUNCTION(oci) { /* XXX NYI - OCI(num_links) = + OCI(num_links) = OCI(num_persistent); */ @@ -578,6 +606,13 @@ oci_debug("php_rinit_oci"); + /* close all timed out connections (if check is enabled) */ + if (-1 != OCI(connection_timeout)) { + OCI(current_timestamp) = time(NULL); + zend_hash_apply(OCI(user), (apply_func_t)_session_rcleanup TSRMLS_CC); + zend_hash_apply(OCI(server), (apply_func_t)_server_rcleanup TSRMLS_CC); + } + return SUCCESS; } @@ -597,6 +632,8 @@ PHP_MSHUTDOWN_FUNCTION(oci) { + UNREGISTER_INI_ENTRIES(); + OCI(shutdown) = 1; oci_debug("START php_mshutdown_oci"); @@ -611,7 +648,7 @@ free(OCI(server)); CALL_OCI(OCIHandleFree( - (dvoid *)OCI(pEnv), + (dvoid *)OCI(pEnv), OCI_HTYPE_ENV)); oci_debug("END php_mshutdown_oci"); @@ -649,6 +686,8 @@ #endif php_info_print_table_end(); + DISPLAY_INI_ENTRIES(); + } /* }}} */ @@ -844,7 +883,7 @@ if (connection->pError) { CALL_OCI(OCIHandleFree( - (dvoid *) connection->pError, + (dvoid *) connection->pError, (ub4) OCI_HTYPE_ERROR)); } @@ -2153,30 +2192,32 @@ oci_session *session = 0, *psession = 0; OCISvcCtx *svchp = 0; char *hashed_details; + struct timeval tv; + int sec, usec; #ifdef HAVE_OCI9 ub2 charsetid; #endif TSRMLS_FETCH(); - /* + /* check if we already have this user authenticated - we will reuse authenticated users within a request no matter if the user requested a persistent + we will reuse authenticated users within a request no matter if the user requested a persistent connections or not! - - but only as pesistent requested connections will be kept between requests! - */ - hashed_details = (char *) malloc(strlen(SAFE_STRING(username))+ - strlen(SAFE_STRING(password))+ - strlen(SAFE_STRING(server->dbname))+1); - - sprintf(hashed_details,"%s%s%s", - SAFE_STRING(username), - SAFE_STRING(password), - SAFE_STRING(server->dbname)); + but only as persistent requested connections will be kept between requests! + */ if (! exclusive) { + hashed_details = (char *) malloc(strlen(SAFE_STRING(username))+ + strlen(SAFE_STRING(password))+ + strlen(SAFE_STRING(server->dbname))+1); + + sprintf(hashed_details,"%s%s%s", + SAFE_STRING(username), + SAFE_STRING(password), + SAFE_STRING(server->dbname)); + zend_hash_find(OCI(user), hashed_details, strlen(hashed_details)+1, (void **) &session); if (session) { @@ -2191,6 +2232,14 @@ /* breakthru to open */ } } + } else { + gettimeofday((struct timeval *) &tv, (struct timezone *) NULL); + sec = (int) tv.tv_sec; + usec = (int) (tv.tv_usec % 1000000); + /* The max value usec can have is 0xF423F, so we use only five hex + digits for usec and eigth hex digits for sec. */ + hashed_details = (char *) malloc(8+5+1); /* always enough */ + sprintf(hashed_details, "%08x%05x", tv.tv_sec, tv.tv_usec); } session = calloc(1,sizeof(oci_session)); @@ -2217,16 +2266,16 @@ CALL_OCI_RETURN(charsetid, OCINlsCharSetNameToId( OCI(pEnv), charset)); - + session->charsetId = charsetid; oci_debug("oci_do_connect: using charset id=%d",charsetid); } - + /* create an environment using the character set id, Oracle 9i+ ONLY */ CALL_OCI(OCIEnvNlsCreate( &session->pEnv, - OCI_DEFAULT, - 0, + OCI_DEFAULT, + 0, NULL, NULL, NULL, @@ -2245,12 +2294,12 @@ /* allocate temporary Service Context */ CALL_OCI_RETURN(OCI(error), OCIHandleAlloc( - session->pEnv, - (dvoid **)&svchp, - OCI_HTYPE_SVCCTX, - 0, + session->pEnv, + (dvoid **)&svchp, + OCI_HTYPE_SVCCTX, + 0, NULL)); - + if (OCI(error) != OCI_SUCCESS) { oci_error(OCI(pError), "_oci_open_session: OCIHandleAlloc OCI_HTYPE_SVCCTX", OCI(error)); goto CLEANUP; @@ -2258,10 +2307,10 @@ /* allocate private session-handle */ CALL_OCI_RETURN(OCI(error), OCIHandleAlloc( - session->pEnv, - (dvoid **)&session->pSession, - OCI_HTYPE_SESSION, - 0, + session->pEnv, + (dvoid **)&session->pSession, + OCI_HTYPE_SESSION, + 0, NULL)); if (OCI(error) != OCI_SUCCESS) { @@ -2269,11 +2318,11 @@ goto CLEANUP; } - /* Set the server handle in service handle */ + /* Set the server handle in service handle */ CALL_OCI_RETURN(OCI(error), OCIAttrSet( - svchp, - OCI_HTYPE_SVCCTX, - server->pServer, + svchp, + OCI_HTYPE_SVCCTX, + server->pServer, 0, OCI_ATTR_SERVER, OCI(pError))); @@ -2285,11 +2334,11 @@ /* set the username in user handle */ CALL_OCI_RETURN(OCI(error), OCIAttrSet( - (dvoid *) session->pSession, - (ub4) OCI_HTYPE_SESSION, - (dvoid *) username, - (ub4) strlen(username), - (ub4) OCI_ATTR_USERNAME, + (dvoid *) session->pSession, + (ub4) OCI_HTYPE_SESSION, + (dvoid *) username, + (ub4) strlen(username), + (ub4) OCI_ATTR_USERNAME, OCI(pError))); if (OCI(error) != OCI_SUCCESS) { @@ -2299,11 +2348,11 @@ /* set the password in user handle */ CALL_OCI_RETURN(OCI(error), OCIAttrSet( - (dvoid *) session->pSession, - (ub4) OCI_HTYPE_SESSION, - (dvoid *) password, - (ub4) strlen(password), - (ub4) OCI_ATTR_PASSWORD, + (dvoid *) session->pSession, + (ub4) OCI_HTYPE_SESSION, + (dvoid *) password, + (ub4) strlen(password), + (ub4) OCI_ATTR_PASSWORD, OCI(pError))); if (OCI(error) != OCI_SUCCESS) { @@ -2312,10 +2361,10 @@ } CALL_OCI_RETURN(OCI(error), OCISessionBegin( - svchp, - OCI(pError), - session->pSession, - (ub4) OCI_CRED_RDBMS, + svchp, + OCI(pError), + session->pSession, + (ub4) OCI_CRED_RDBMS, (ub4) OCI_DEFAULT)); if (OCI(error) != OCI_SUCCESS) { @@ -2325,7 +2374,7 @@ /* Free Temporary Service Context */ CALL_OCI(OCIHandleFree( - (dvoid *) svchp, + (dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX)); if (exclusive) { @@ -2333,7 +2382,7 @@ } else { zend_hash_update(OCI(user), session->hashed_details, - strlen(session->hashed_details)+1, + strlen(session->hashed_details)+1, (void *)session, sizeof(oci_session), (void**)&psession); @@ -2627,7 +2676,8 @@ oci_server *server = 0; oci_session *session = 0; oci_connection *connection = 0; - + int i, len; + /* if a forth parameter is handed over, it is the charset identifier (but is only used in Oracle 9i+) */ if (zend_get_parameters_ex(4, &userParam, &passParam, &dbParam, &charParam) == SUCCESS) { convert_to_string_ex(userParam); @@ -2665,18 +2715,34 @@ goto CLEANUP; } + /* if enabled in php.ini, convert credentials to uppercase */ + if (OCI(credentials_toupper)) { + for (i = 0, len = strlen(SAFE_STRING(username)); i < len; i++) { + username[i] = toupper(username[i]); + } + for (i = 0, len = strlen(SAFE_STRING(password)); i < len; i++) { + password[i] = toupper(password[i]); + } + for (i = 0, len = strlen(SAFE_STRING(dbname)); i < len; i++) { + dbname[i] = toupper(dbname[i]); + } + } + server = _oci_open_server(dbname,persistent); if (! server) { goto CLEANUP; } + /* set/update server handle timestamp */ + server->timestamp = time(NULL); + if (exclusive) { /* exlusive session can never be persistent!*/ persistent = 0; } else { /* if our server-context is not persistent we can't */ - persistent = server->persistent; + persistent = (server->persistent) ? persistent : 0; } session = _oci_open_session(server,username,password,persistent,exclusive,charset); @@ -2690,10 +2756,10 @@ /* allocate our private error-handle */ CALL_OCI_RETURN(OCI(error), OCIHandleAlloc( - connection->session->pEnv, - (dvoid **)&connection->pError, - OCI_HTYPE_ERROR, - 0, + connection->session->pEnv, + (dvoid **)&connection->pError, + OCI_HTYPE_ERROR, + 0, NULL)); if (OCI(error) != OCI_SUCCESS) { Index: php_oci8.h =================================================================== RCS file: /repository/php4/ext/oci8/php_oci8.h,v retrieving revision 1.28 diff -u -r1.28 php_oci8.h --- php_oci8.h 18 Mar 2003 12:06:01 -0000 1.28 +++ php_oci8.h 6 Apr 2003 16:57:21 -0000 @@ -40,7 +40,7 @@ #define PHP_OCI_API __declspec(dllexport) #else #define PHP_OCI_API -#endif +#endif #if defined(min) #undef min @@ -55,6 +55,7 @@ int num; int persistent; int is_open; + time_t timestamp; char *dbname; OCIServer *pServer; #if 0 @@ -182,7 +183,11 @@ long num_links; */ - HashTable *server; + long connection_timeout; /* from php.ini */ + int credentials_toupper; /* from php.ini */ + time_t current_timestamp; /* set by PHP_RINIT_FUNCTION */ + + HashTable *server; HashTable *user; OCIEnv *pEnv;