CVS update: php3/functions

From: Date: Thu, 15 Apr 1999 20:47:43 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5080@lists.php.net to get a copy of this message
Date: Thursday April 15, 1999 @ 16:47 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv29234 Modified Files: oci8.c php3_oci8.h Log Message: now i got the grip on freeing resources.... persistent connections still leak -> but not for much longer!!! Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.77 php3/functions/oci8.c:1.78 *** php3/functions/oci8.c:1.77 Thu Apr 15 09:14:28 1999 --- php3/functions/oci8.c Thu Apr 15 16:47:41 1999 *************** *** 33,39 **** #define OCI8_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */ ! /* $Id: oci8.c,v 1.77 1999/04/15 13:14:28 thies Exp $ */ /* TODO list: * --- 33,39 ---- #define OCI8_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */ ! /* $Id: oci8.c,v 1.78 1999/04/15 20:47:41 thies Exp $ */ /* TODO list: * *************** *** 75,89 **** #if HAVE_OCI8 - #define SAFE_STRING(s) ((s)?(s):"") - - #include "php3_list.h" - #if !(WIN32|WINNT) - # include "build-defs.h" - #endif - #include "snprintf.h" - #include "head.h" - /* XXXXXXXXXXXXXXXXXXXXXXXx this is needed due to a brain-dead change in the ocidfn.h header somewhere between 8.0.3 and 8.0.5 - sorry no consistend way to --- 75,80 ---- *************** *** 98,103 **** --- 89,103 ---- #endif + #define SAFE_STRING(s) ((s)?(s):"") + + #include "php3_list.h" + #if !(WIN32|WINNT) + # include "build-defs.h" + #endif + #include "snprintf.h" + #include "head.h" + /* }}} */ /* {{{ thread safety stuff */ *************** *** 166,173 **** static void _oci8_close_conn(oci8_connection *connection); static void _oci8_free_stmt(oci8_statement *statement); static void _oci8_free_column(oci8_out_column *column); ! static void _oci8_detach(oci8_server *server); ! static void _oci8_logoff(oci8_session *session); static void _oci8_free_descr(oci8_descriptor *descr); static oci8_connection *oci8_get_conn(int, const char *, HashTable *, HashTable *); --- 166,173 ---- static void _oci8_close_conn(oci8_connection *connection); static void _oci8_free_stmt(oci8_statement *statement); static void _oci8_free_column(oci8_out_column *column); ! static void _oci8_close_server(oci8_server *server); ! static void _oci8_close_user(oci8_session *session); static void _oci8_free_descr(oci8_descriptor *descr); static oci8_connection *oci8_get_conn(int, const char *, HashTable *, HashTable *); *************** *** 181,187 **** static ub4 oci8_loaddesc(oci8_connection *, oci8_descriptor *, char **); static void oci8_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent); ! static oci8_server *oci8_attach(char *dbname,int persistent,HashTable *list, HashTable *plist); static oci8_session *oci8_login(oci8_server* server,char *username,char *password,int persistent,HashTable *list, HashTable *plist); --- 181,187 ---- static ub4 oci8_loaddesc(oci8_connection *, oci8_descriptor *, char **); static void oci8_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent); ! static oci8_server *oci8_open_server(char *dbname,int persistent,HashTable *list, HashTable *plist); static oci8_session *oci8_login(oci8_server* server,char *username,char *password,int persistent,HashTable *list, HashTable *plist); *************** *** 207,213 **** void php3_oci8_fetchstatement(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_freestatement(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_internaldebug(INTERNAL_FUNCTION_PARAMETERS); ! void php3_oci8_logoff(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_logon(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_plogon(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_error(INTERNAL_FUNCTION_PARAMETERS); --- 207,213 ---- void php3_oci8_fetchstatement(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_freestatement(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_internaldebug(INTERNAL_FUNCTION_PARAMETERS); ! void php3_oci8_logout(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_logon(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_plogon(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_error(INTERNAL_FUNCTION_PARAMETERS); *************** *** 256,262 **** {"ociserverversion", php3_oci8_serverversion, NULL}, {"ocistatementtype", php3_oci8_statementtype, NULL}, {"ocirowcount", php3_oci8_rowcount, NULL}, ! {"ocilogoff", php3_oci8_logoff, NULL}, {"ocilogon", php3_oci8_logon, NULL}, {"ociplogon", php3_oci8_plogon, NULL}, {"ocierror", php3_oci8_error, NULL}, --- 256,262 ---- {"ociserverversion", php3_oci8_serverversion, NULL}, {"ocistatementtype", php3_oci8_statementtype, NULL}, {"ocirowcount", php3_oci8_rowcount, NULL}, ! {"ocilogoff", php3_oci8_logout, NULL}, {"ocilogon", php3_oci8_logon, NULL}, {"ociplogon", php3_oci8_plogon, NULL}, {"ocierror", php3_oci8_error, NULL}, *************** *** 281,286 **** --- 281,313 ---- }; /* }}} */ + /* {{{ debug malloc/realloc/free */ + + #if OCI8_USE_EMALLOC + CONST dvoid *ocimalloc(dvoid *ctx, size_t size) + { + dvoid *ret; + ret = (dvoid *)emalloc(size); + oci8_debug("ocimalloc(%d) = %08x", size,ret); + return ret; + } + + CONST dvoid *ocirealloc(dvoid *ctx, dvoid *ptr, size_t size) + { + dvoid *ret; + oci8_debug("ocirealloc(%08x, %d)", ptr, size); + ret = (dvoid *)erealloc(ptr, size); + return ptr; + } + + CONST void ocifree(dvoid *ctx, dvoid *ptr) + { + oci8_debug("ocifree(%08x)", ptr); + efree(ptr); + } + #endif + + /* }}} */ /* {{{ startup, shutdown and info functions */ int php3_minit_oci8(INIT_FUNC_ARGS) *************** *** 323,348 **** } OCI8_GLOBAL(php3_oci8_module).num_persistent = 0; - - OCI8_GLOBAL(php3_oci8_module).le_conn = - register_list_destructors(_oci8_close_conn, NULL); - - OCI8_GLOBAL(php3_oci8_module).le_stmt = - register_list_destructors(_oci8_free_stmt, NULL); ! OCI8_GLOBAL(php3_oci8_module).le_server = ! register_list_destructors(_oci8_detach, NULL); ! OCI8_GLOBAL(php3_oci8_module).le_pserver = ! register_list_destructors(_oci8_detach, NULL); ! OCI8_GLOBAL(php3_oci8_module).le_session = ! register_list_destructors(_oci8_logoff, NULL); ! OCI8_GLOBAL(php3_oci8_module).le_psession = ! register_list_destructors(_oci8_logoff, NULL); - if (cfg_get_long("oci8.debug_mode", &OCI8_GLOBAL(php3_oci8_module).debug_mode) == FAILURE) { OCI8_GLOBAL(php3_oci8_module).debug_mode = 0; --- 350,368 ---- } OCI8_GLOBAL(php3_oci8_module).num_persistent = 0; ! OCI8_GLOBAL(php3_oci8_module).user_num = 1000; ! OCI8_GLOBAL(php3_oci8_module).server_num = 2000; ! OCI8_GLOBAL(php3_oci8_module).le_conn = register_list_destructors(_oci8_close_conn, NULL); ! OCI8_GLOBAL(php3_oci8_module).le_stmt = register_list_destructors(_oci8_free_stmt, NULL); ! OCI8_GLOBAL(php3_oci8_module).user = malloc(sizeof(HashTable)); ! _php3_hash_init(OCI8_GLOBAL(php3_oci8_module).user, 13, NULL,(void (*)(void *)) _oci8_close_user, 1); ! OCI8_GLOBAL(php3_oci8_module).server = malloc(sizeof(HashTable)); ! _php3_hash_init(OCI8_GLOBAL(php3_oci8_module).server, 13, NULL,(void (*)(void *)) _oci8_close_server, 1); if (cfg_get_long("oci8.debug_mode", &OCI8_GLOBAL(php3_oci8_module).debug_mode) == FAILURE) { OCI8_GLOBAL(php3_oci8_module).debug_mode = 0; *************** *** 384,390 **** REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); #if OCI8_USE_EMALLOC ! OCIInitialize(OCI_DEFAULT, (dvoid *)connection, ocimalloc, ocirealloc, ocifree); #else OCIInitialize(OCI_DEFAULT, NULL, NULL, NULL, NULL); #endif --- 404,410 ---- REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); #if OCI8_USE_EMALLOC ! OCIInitialize(OCI_DEFAULT, NULL, ocimalloc, ocirealloc, ocifree); #else OCIInitialize(OCI_DEFAULT, NULL, NULL, NULL, NULL); #endif *************** *** 455,487 **** } /* }}} */ - /* {{{ debug malloc/realloc/free */ - - #if OCI8_USE_EMALLOC - CONST dvoid *ocimalloc(dvoid *ctx, size_t size) - { - dvoid *ret; - ret = (dvoid *)emalloc(size); - oci8_debug("ocimalloc(%d) = %08x", size,ret); - return ret; - } - - CONST dvoid *ocirealloc(dvoid *ctx, dvoid *ptr, size_t size) - { - dvoid *ret; - oci8_debug("ocirealloc(%08x, %d)", ptr, size); - ret = (dvoid *)erealloc(ptr, size); - return ptr; - } - - CONST void ocifree(dvoid *ctx, dvoid *ptr) - { - oci8_debug("ocifree(%08x)", ptr); - efree(ptr); - } - #endif - - /* }}} */ /* {{{ oci8_free_define() */ static int --- 475,480 ---- *************** *** 606,611 **** --- 599,606 ---- OCIHandleFree((dvoid *) connection->pError, (ub4) OCI_HTYPE_ERROR); } + _oci8_close_user(connection->session); + efree(connection); } *************** *** 902,907 **** --- 897,910 ---- return 0; } + #if 0 /* testing */ + { ub4 prefetch = 10*1024; + + error = oci8_error(statement->pError, "OCIAttrSet OCI_ATTR_PREFETCH_ROWS", + OCIAttrSet(statement->pStmt,OCI_HTYPE_STMT,&prefetch,0,OCI_ATTR_PREFETCH_MEMORY,&statement->pError)); + } + #endif + statement->last_query = estrdup(query); statement->conn = connection; statement->id = php3_list_insert(statement, OCI8_GLOBAL(php3_oci8_module).le_stmt); *************** *** 982,1001 **** return 0; } - #if 0 - error = oci8_error( - statement->pError, - "OCIHandleAlloc OCI_DTYPE_PARAM", - OCIHandleAlloc( - OCI8_GLOBAL(php3_oci8_module).pEnv, - (dvoid **)&param, - OCI_DTYPE_PARAM, - 0, - NULL)); - if (error) { - return 0; /* XXX we loose memory!!! */ - } - #endif OCIHandleAlloc( OCI8_GLOBAL(php3_oci8_module).pEnv, (dvoid **)&param, --- 985,990 ---- *************** *** 1515,1522 **** sword error; oci8_session *session = 0; OCISvcCtx *svchp = 0; - list_entry *le; - list_entry new_le; char *hashed_details = 0; int hashed_details_length; OCI8_TLS_VARS; --- 1504,1509 ---- *************** *** 1540,1561 **** SAFE_STRING(password), SAFE_STRING(server->dbname)); ! if (_php3_hash_find(plist, hashed_details, hashed_details_length+1, (void **) &le)==SUCCESS) { ! session = (oci8_session *) le->ptr; ! } else if (_php3_hash_find(list, hashed_details, hashed_details_length+1, (void **) &le)==SUCCESS) { ! session = (oci8_session *) le->ptr; ! } if (session) { ! oci8_debug("oci8_login persistent sess=%d",session->id); return session; } ! if (persistent) { ! session = calloc(1,sizeof(oci8_session)); ! } else { ! session = ecalloc(1,sizeof(oci8_session)); ! } if (! session) { goto CLEANUP; --- 1527,1542 ---- SAFE_STRING(password), SAFE_STRING(server->dbname)); ! _php3_hash_find(OCI8_GLOBAL(php3_oci8_module).user, hashed_details, hashed_details_length+1, (void **) &session); if (session) { ! efree(hashed_details); ! session->refcount++; ! oci8_debug("oci8_login persistent sess=%d refcount=%d",session->num,session->refcount); return session; } ! session = calloc(1,sizeof(oci8_session)); if (! session) { goto CLEANUP; *************** *** 1638,1644 **** session->pSession, (ub4) OCI_CRED_RDBMS, (ub4) OCI_DEFAULT); ! if (error != OCI_SUCCESS) { oci8_error(session->pError, "OCISessionBegin", error); goto CLEANUP; } --- 1619,1625 ---- session->pSession, (ub4) OCI_CRED_RDBMS, (ub4) OCI_DEFAULT); ! if (error != OCI_SUCCESS) { oci8_error(session->pError, "OCISessionBegin", error); goto CLEANUP; } *************** *** 1646,1676 **** /* Free Temporary Service Context */ OCIHandleFree((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX); - new_le.ptr = session; ! if (persistent) { ! session->id = php3_list_insert(session, OCI8_GLOBAL(php3_oci8_module).le_psession); ! _php3_hash_update(plist, ! hashed_details, ! hashed_details_length+1, ! (void *) &new_le, ! sizeof(list_entry), ! NULL); ! } else { ! session->id = php3_list_insert(session, OCI8_GLOBAL(php3_oci8_module).le_session); ! _php3_hash_update(list, ! hashed_details, ! hashed_details_length+1, ! (void *) &new_le, ! sizeof(list_entry), ! NULL); ! } ! oci8_debug("oci8_login new sess=%d",session->id); if (hashed_details) { efree(hashed_details); } return session; --- 1627,1651 ---- /* Free Temporary Service Context */ OCIHandleFree((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX); ! session->refcount++; ! session->num = OCI8_GLOBAL(php3_oci8_module).user_num++; ! _php3_hash_update(OCI8_GLOBAL(php3_oci8_module).user, ! hashed_details, ! hashed_details_length+1, ! (void *) session, ! sizeof(oci8_session), ! (void **) &session); + oci8_debug("oci8_login new sess=%d refcount=%d",session->num,session->refcount); + if (hashed_details) { efree(hashed_details); } + + session->refcount++; + session->open = 1; return session; *************** *** 1680,1686 **** } if (session) { ! _oci8_logoff(session); } efree(session); --- 1655,1661 ---- } if (session) { ! _oci8_close_user(session); } efree(session); *************** *** 1689,1705 **** } /* }}} */ ! /* {{{ _oci8_logoff() */ static void ! _oci8_logoff(oci8_session *session) { if (! session) { return; } ! oci8_debug("_oci8_logoff: sess=%d",session->id); } /* }}} */ --- 1664,1743 ---- } /* }}} */ ! /* {{{ _oci8_close_user() */ static void ! _oci8_close_user(oci8_session *session) { + OCISvcCtx *svchp; + sword error; + if (! session) { return; } + + session->refcount--; + + oci8_debug("_oci8_close_user: sess=%d sess-ref=%d conn-ref=%d",session->num,session->refcount,session->server->refcount); + + if ((session->refcount != 0) || (session->persistent)) { + return; + } + + session->open = 0; + + oci8_debug("_oci8_close_user: logging-off sess=%d",session->num); + + /* Temporary Service Context */ + error = OCIHandleAlloc(OCI8_GLOBAL(php3_oci8_module).pEnv, + (dvoid **) &svchp, + (ub4) OCI_HTYPE_SVCCTX, + (size_t) 0, + (dvoid **) 0); + + if (error != OCI_SUCCESS) { + oci8_error(session->pError, "_oci8_close_user OCIHandleAlloc OCI_HTYPE_SVCCTX", error); + } + + /* Set the server handle in service handle */ + error = OCIAttrSet(svchp, + OCI_HTYPE_SVCCTX, + session->server->pServer, + 0, + OCI_ATTR_SERVER, + session->pError); + if (error != OCI_SUCCESS) { + oci8_error(session->pError, "_oci8_close_user: OCIAttrSet OCI_ATTR_SERVER", error); + } + + /* Set the Authentication handle in the service handle */ + error = OCIAttrSet(svchp, + OCI_HTYPE_SVCCTX, + session->pSession, + 0, + OCI_ATTR_SESSION, + session->pError); + if (error != OCI_SUCCESS) { + oci8_error(session->pError, "_oci8_close_user: OCIAttrSet OCI_ATTR_SESSION", error); + } + + error = OCISessionEnd(svchp, + session->pError, + session->pSession, + (ub4) 0); + if (error != OCI_SUCCESS) { + oci8_error(session->pError, "_oci8_close_user: OCISessionEnd", error); + } + + OCIHandleFree((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX); + OCIHandleFree((dvoid *) session->pSession, (ub4) OCI_HTYPE_SESSION); + + /* + _oci8_close_server(session->server); + */ ! free(session); } /* }}} */ *************** *** 1716,1728 **** OCIDescriptorFree(descr->ocidescr, descr->type); } /* }}} */ ! /* {{{ oci8_attach() */ ! static oci8_server *oci8_attach(char *dbname,int persistent,HashTable *list, HashTable *plist) { oci8_server *server = 0; - list_entry *le; - list_entry new_le; sword error; char *hashed_details = 0; int hashed_details_length; --- 1754,1764 ---- OCIDescriptorFree(descr->ocidescr, descr->type); } /* }}} */ ! /* {{{ oci8_open_server() */ ! static oci8_server *oci8_open_server(char *dbname,int persistent,HashTable *list, HashTable *plist) { oci8_server *server = 0; sword error; char *hashed_details = 0; int hashed_details_length; *************** *** 1741,1763 **** hashed_details = (char *) emalloc(hashed_details_length+1); sprintf(hashed_details,"oci8_server_%s",SAFE_STRING((char *)dbname)); ! if (_php3_hash_find(plist, hashed_details, hashed_details_length+1, (void **) &le)==SUCCESS) { ! server = (oci8_server *) le->ptr; ! } else if (_php3_hash_find(list, hashed_details, hashed_details_length+1, (void **) &le)==SUCCESS) { ! server = (oci8_server *) le->ptr; ! } if (server) { ! oci8_debug("oci8_attach persistent conn=%d (%s)",server->id,server->dbname); return server; } - ! if (persistent) { ! server = calloc(1,sizeof(oci8_server)); ! } else { ! server = ecalloc(1,sizeof(oci8_server)); ! } if (! server) { goto CLEANUP; --- 1777,1792 ---- hashed_details = (char *) emalloc(hashed_details_length+1); sprintf(hashed_details,"oci8_server_%s",SAFE_STRING((char *)dbname)); ! _php3_hash_find(OCI8_GLOBAL(php3_oci8_module).server, hashed_details, hashed_details_length+1, (void **) &server); if (server) { ! efree(hashed_details); ! server->refcount++; ! oci8_debug("oci8_open_server persistent conn=%d refcount=%d (%s)",server->num,server->refcount,server->dbname); return server; } ! server = calloc(1,sizeof(oci8_server)); if (! server) { goto CLEANUP; *************** *** 1786,1821 **** (ub4) OCI_DEFAULT); if (error) { ! oci8_error(server->pError, "oci8_attach", error); goto CLEANUP; } ! new_le.ptr = server; ! if (persistent) { ! server->id = php3_list_insert(server,OCI8_GLOBAL(php3_oci8_module).le_pserver); ! _php3_hash_update(plist, ! hashed_details, ! hashed_details_length+1, ! (void *) &new_le, ! sizeof(list_entry), ! NULL); ! } else { ! server->id = php3_list_insert(server,OCI8_GLOBAL(php3_oci8_module).le_server); ! _php3_hash_update(list, ! hashed_details, ! hashed_details_length+1, ! (void *) &new_le, ! sizeof(list_entry), ! NULL); ! } ! oci8_debug("oci8_attach new conn=%d (%s)",server->id,server->dbname); if (hashed_details) { efree(hashed_details); } return server; CLEANUP: --- 1815,1843 ---- (ub4) OCI_DEFAULT); if (error) { ! oci8_error(server->pError, "oci8_open_server", error); goto CLEANUP; } ! server->refcount++; ! server->num = OCI8_GLOBAL(php3_oci8_module).server_num++; ! _php3_hash_update(OCI8_GLOBAL(php3_oci8_module).server, ! hashed_details, ! hashed_details_length+1, ! (void *) server, ! sizeof(oci8_server), ! (void **) &server); ! oci8_debug("oci8_open_server new conn=%d refcount=%d (%s)",server->num,server->refcount,server->dbname); if (hashed_details) { efree(hashed_details); } + server->refcount++; + server->open = 1; + return server; CLEANUP: *************** *** 1824,1847 **** } if (server) { ! _oci8_detach(server); } return 0; } /* }}} */ ! /* {{{ _oci8_detach() */ static void ! _oci8_detach(oci8_server *server) { if (! server) { return; } ! oci8_debug("_oci8_detach: conn=%d",server->id); } /* }}} */ --- 1846,1883 ---- } if (server) { ! _oci8_close_server(server); } return 0; } /* }}} */ ! /* {{{ _oci8_close_server() */ static void ! _oci8_close_server(oci8_server *server) { + OCI8_TLS_VARS; + if (! server) { return; } ! server->refcount--; ! ! oci8_debug("_oci8_close_server: conn=%d conn-ref=%d",server->num,server->refcount); ! ! if ((server->refcount != 0) || (server->persistent)) { ! return; ! } ! ! server->open = 0; ! ! oci8_debug("_oci8_close_server: detaching conn=%d",server->num); ! ! free(server); } /* }}} */ *************** *** 1857,1863 **** oci8_connection *connection = 0; sword error; OCI8_TLS_VARS; ! if (getParameters(ht, 3, &userParam, &passParam, &dbParam) == SUCCESS) { convert_to_string(userParam); convert_to_string(passParam); --- 1893,1899 ---- oci8_connection *connection = 0; sword error; OCI8_TLS_VARS; ! if (getParameters(ht, 3, &userParam, &passParam, &dbParam) == SUCCESS) { convert_to_string(userParam); convert_to_string(passParam); *************** *** 1883,1889 **** goto CLEANUP; } ! server = oci8_attach(dbname,persistent,list,plist); if (! server) { goto CLEANUP; --- 1919,1925 ---- goto CLEANUP; } ! server = oci8_open_server(dbname,persistent,list,plist); if (! server) { goto CLEANUP; *************** *** 2855,2861 **** /* Logs off and disconnects. */ ! void php3_oci8_logoff(INTERNAL_FUNCTION_PARAMETERS) { oci8_connection *connection; pval *arg; --- 2891,2897 ---- /* Logs off and disconnects. */ ! void php3_oci8_logout(INTERNAL_FUNCTION_PARAMETERS) { oci8_connection *connection; pval *arg; Index: php3/functions/php3_oci8.h diff -c php3/functions/php3_oci8.h:1.37 php3/functions/php3_oci8.h:1.38 *** php3/functions/php3_oci8.h:1.37 Wed Apr 7 12:30:01 1999 --- php3/functions/php3_oci8.h Thu Apr 15 16:47:42 1999 *************** *** 52,67 **** # include <oci.h> typedef struct { ! int id; int persistent; char dbname[ 64 ]; OCIError *pError; OCIServer *pServer; } oci8_server; typedef struct { ! int id; int persistent; oci8_server *server; OCIError *pError; OCISession *pSession; --- 52,71 ---- # include <oci.h> typedef struct { ! int num; int persistent; + int refcount; + int open; char dbname[ 64 ]; OCIError *pError; OCIServer *pServer; } oci8_server; typedef struct { ! int num; int persistent; + int refcount; + int open; oci8_server *server; OCIError *pError; OCISession *pSession; *************** *** 147,170 **** int le_conn; /* active connections */ int le_stmt; /* active statements */ ! int le_server; /* server-handles */ ! int le_pserver; /* pesistent server-handles */ - int le_session; /* session-handles */ - int le_psession;/* pesistent session-handles */ - OCIEnv *pEnv; } oci8_module; extern php3_module_entry oci8_module_entry; ! # define oci8_module_ptr &oci8_module_entry ! ! # define OCI8_MAX_NAME_LEN 64 ! # define OCI8_MAX_DATA_SIZE 2097152 /* two megs */ ! /* this one has to be changed to include persistent connections as well */ ! # define OCI8_SERVER_TYPE(x) (((x)==OCI8_GLOBAL(php3_oci8_module).le_server) || ((x)==OCI8_GLOBAL(php3_oci8_module).le_pserver)) ! # define OCI8_SESSION_TYPE(x) (((x)==OCI8_GLOBAL(php3_oci8_module).le_session) || ((x)==OCI8_GLOBAL(php3_oci8_module).le_psession)) # define OCI8_CONN_TYPE(x) ((x)==OCI8_GLOBAL(php3_oci8_module).le_conn) # define OCI8_STMT_TYPE(x) ((x)==OCI8_GLOBAL(php3_oci8_module).le_stmt) --- 151,169 ---- int le_conn; /* active connections */ int le_stmt; /* active statements */ ! int server_num; ! HashTable *server; ! int user_num; ! HashTable *user; OCIEnv *pEnv; } oci8_module; extern php3_module_entry oci8_module_entry; ! #define oci8_module_ptr &oci8_module_entry ! #define OCI8_MAX_NAME_LEN 64 ! #define OCI8_MAX_DATA_SIZE 2097152 /* two megs */ # define OCI8_CONN_TYPE(x) ((x)==OCI8_GLOBAL(php3_oci8_module).le_conn) # define OCI8_STMT_TYPE(x) ((x)==OCI8_GLOBAL(php3_oci8_module).le_stmt) -- 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 (#5080) next »