CVS update: php3/functions

From: Date: Wed, 07 Apr 1999 16:30:01 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4976@lists.php.net to get a copy of this message
Date: Wednesday April 7, 1999 @ 12:30 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv24337/functions Modified Files: oci8.c php3_oci8.h Log Message: added support for persistent connections. note: i've not yet implemented configuration paramters! Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.74 php3/functions/oci8.c:1.75 *** php3/functions/oci8.c:1.74 Wed Apr 7 08:10:14 1999 --- php3/functions/oci8.c Wed Apr 7 12:30:00 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.74 1999/04/07 12:10:14 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.75 1999/04/07 16:30:00 thies Exp $ */ /* TODO list: * *************** *** 148,182 **** static ub4 oci8_error(OCIError *err_p, char *what, sword status); /* static int oci8_ping(oci8_connection *conn); XXX NYI */ static void oci8_debug(const char *format,...); - static void oci8_debugcol(oci8_out_column * col,const char *format,...); - static void oci8_close_conn(oci8_connection *connection); - static void oci8_free_descr(oci8_descriptor *descr); - static void oci8_free_stmt(oci8_statement *statement); ! static oci8_server *oci8_get_server(int server_ind, const char *func, HashTable *list, HashTable *plist); static oci8_connection *oci8_get_conn(int, const char *, HashTable *, HashTable *); static oci8_statement *oci8_get_stmt(int, const char *, HashTable *); static oci8_out_column *oci8_get_col(oci8_statement *, int, pval *, char *); static int oci8_make_pval(pval *,int,oci8_out_column *, char *,HashTable *, int mode); static int oci8_parse(oci8_connection *, text *, ub4, HashTable *); static int oci8_execute(oci8_statement *, char *,ub4 mode); static int oci8_fetch(oci8_statement *, ub4, char *); 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 int oci8_detach(oci8_server *server); - static oci8_session *oci8_open(oci8_server* server,char *username,char *password,int persistent,HashTable *list, HashTable *plist); - static int oci8_close(oci8_session *session); /* bind callback functions */ static sb4 oci8_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **); static sb4 oci8_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **); /* define callback function */ static sb4 oci8_define_callback(dvoid *, OCIDefine *, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **); - /* }}} */ /* {{{ extension function prototypes */ --- 148,182 ---- static ub4 oci8_error(OCIError *err_p, char *what, sword status); /* static int oci8_ping(oci8_connection *conn); XXX NYI */ static void oci8_debug(const char *format,...); ! 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 oci8_connection *oci8_get_conn(int, const char *, HashTable *, HashTable *); static oci8_statement *oci8_get_stmt(int, const char *, HashTable *); static oci8_out_column *oci8_get_col(oci8_statement *, int, pval *, char *); + static int oci8_make_pval(pval *,int,oci8_out_column *, char *,HashTable *, int mode); static int oci8_parse(oci8_connection *, text *, ub4, HashTable *); static int oci8_execute(oci8_statement *, char *,ub4 mode); static int oci8_fetch(oci8_statement *, ub4, char *); 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); /* bind callback functions */ static sb4 oci8_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **); static sb4 oci8_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **); + /* define callback function */ static sb4 oci8_define_callback(dvoid *, OCIDefine *, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **); /* }}} */ /* {{{ extension function prototypes */ *************** *** 194,204 **** void php3_oci8_internaldebug(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_logoff(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_logon(INTERNAL_FUNCTION_PARAMETERS); - void php3_oci8_detach(INTERNAL_FUNCTION_PARAMETERS); - void php3_oci8_attach(INTERNAL_FUNCTION_PARAMETERS); - void php3_oci8_pattach(INTERNAL_FUNCTION_PARAMETERS); - void php3_oci8_open(INTERNAL_FUNCTION_PARAMETERS); - void php3_oci8_close(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_plogon(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_error(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_freedesc(INTERNAL_FUNCTION_PARAMETERS); --- 194,199 ---- *************** *** 248,258 **** {"ocirowcount", php3_oci8_rowcount, NULL}, {"ocilogoff", php3_oci8_logoff, NULL}, {"ocilogon", php3_oci8_logon, NULL}, - {"ocidetach", php3_oci8_detach, NULL}, - {"ociattach", php3_oci8_attach, NULL}, - {"ocipattach", php3_oci8_pattach, NULL}, - {"ociopen", php3_oci8_open, NULL}, - {"ociclose", php3_oci8_close, NULL}, {"ociplogon", php3_oci8_plogon, NULL}, {"ocierror", php3_oci8_error, NULL}, {"ocifreedescriptor",php3_oci8_freedesc, NULL}, --- 243,248 ---- *************** *** 319,347 **** OCI8_GLOBAL(php3_oci8_module).num_persistent = 0; - /* OLD stuff */ OCI8_GLOBAL(php3_oci8_module).le_conn = ! register_list_destructors(oci8_close_conn, NULL); ! ! OCI8_GLOBAL(php3_oci8_module).le_pconn = ! register_list_destructors(oci8_close_conn, NULL); OCI8_GLOBAL(php3_oci8_module).le_stmt = ! register_list_destructors(oci8_free_stmt, NULL); - - /* NEW stuff */ 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_close, NULL); OCI8_GLOBAL(php3_oci8_module).le_psession = ! register_list_destructors(oci8_close, NULL); if (cfg_get_long("oci8.debug_mode", --- 309,331 ---- 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", *************** *** 498,510 **** } /* }}} */ ! /* {{{ oci8_free_column() */ ! static int ! oci8_free_column(oci8_out_column *column) { ! oci8_debug("oci8_free_column: %s",column->name); if (column->data) { if (column->is_descr) { _php3_hash_index_del(column->statement->conn->descriptors,(int) column->data); --- 482,499 ---- } /* }}} */ ! /* {{{ _oci8_free_column() */ ! static void ! _oci8_free_column(oci8_out_column *column) { ! ! if (! column) { ! return; ! } + oci8_debug("_oci8_free_column: %s",column->name); + if (column->data) { if (column->is_descr) { _php3_hash_index_del(column->statement->conn->descriptors,(int) column->data); *************** *** 514,535 **** } } } ! return 0; } /* }}} */ ! /* {{{ oci8_free_stmt() */ static void ! oci8_free_stmt(oci8_statement *statement) { OCI8_TLS_VARS; ! oci8_debug("oci8_free_stmt: id=%d last_query=\"%s\" conn=%d persistent=%d.", statement->id, (statement->last_query?(char*)statement->last_query:"???"), ! statement->conn->id, ! statement->conn->persistent); if (statement->pStmt) { OCIHandleFree(statement->pStmt, OCI_HTYPE_STMT); --- 503,532 ---- } } } ! ! if (column->name) { ! efree(column->name); ! } ! ! /* efree(column); XXX php cleares this for us */ } /* }}} */ ! /* {{{ _oci8_free_stmt() */ static void ! _oci8_free_stmt(oci8_statement *statement) { OCI8_TLS_VARS; ! if (! statement) { ! return; ! } ! ! oci8_debug("_oci8_free_stmt: id=%d last_query=\"%s\" conn=%d", statement->id, (statement->last_query?(char*)statement->last_query:"???"), ! statement->conn->id); if (statement->pStmt) { OCIHandleFree(statement->pStmt, OCI_HTYPE_STMT); *************** *** 544,549 **** --- 541,547 ---- if (statement->last_query) { efree(statement->last_query); } + if (statement->columns) { _php3_hash_destroy(statement->columns); efree(statement->columns); *************** *** 563,629 **** } /* }}} */ ! /* {{{ oci8_free_descr() */ static void ! oci8_free_descr(oci8_descriptor *descr) { OCI8_TLS_VARS; - - oci8_debug("oci8_free_descr: %x",descr->ocidescr); - - OCIDescriptorFree(descr->ocidescr, descr->type); - } ! /* }}} */ ! /* {{{ oci8_close_conn() */ ! static void ! oci8_close_conn(oci8_connection *connection) ! { ! OCI8_TLS_VARS; ! oci8_debug("oci8_close_conn: id=%d persistent=%d",connection->id,connection->persistent); if (connection->descriptors) { _php3_hash_destroy(connection->descriptors); } ! if (connection->descriptors) { ! if (connection->persistent) { ! free(connection->descriptors); ! } else { ! efree(connection->descriptors); ! } } - - connection->open = 0; - - oci8_error(connection->pError,"OCISessionEnd", - OCISessionEnd(connection->pServiceContext, connection->pError, connection->pSession, (ub4) 0)); ! oci8_error(connection->pError,"OCIServerDetach", ! OCIServerDetach(connection->pServer, connection->pError, (ub4) OCI_DEFAULT)); ! ! /* from Oracle Doc: All handles may be explicitly deallocated. ! The OCI will deallocate a child handle if the parent is deallocated. ! ! OCIHandleFree((dvoid *)connection->pServiceContext, OCI_HTYPE_SVCCTX); ! OCIHandleFree((dvoid *)connection->pError, OCI_HTYPE_ERROR); ! OCIHandleFree((dvoid *)connection->pServer, OCI_HTYPE_SERVER); ! OCIHandleFree((dvoid *)connection->pSession, OCI_HTYPE_SESSION); ! */ ! if (OCIHandleFree((dvoid *)connection->pEnv, OCI_HTYPE_ENV) != OCI_SUCCESS) { ! oci8_debug("oci8_close_conn: OCIHandleFree returned error"); } ! OCI8_GLOBAL(php3_oci8_module).num_links--; ! ! if (connection->persistent) { ! free(connection); ! } else { ! efree(connection); ! } } /* }}} */ --- 561,597 ---- } /* }}} */ ! /* {{{ _oci8_close_conn() */ static void ! _oci8_close_conn(oci8_connection *connection) { OCI8_TLS_VARS; ! if (! connection) { ! return; ! } ! /* ! as the connection is "only" a in memory service context we do not disconnect from oracle. ! */ ! oci8_debug("_oci8_close_conn: id=%d",connection->id); if (connection->descriptors) { _php3_hash_destroy(connection->descriptors); + efree(connection->descriptors); } ! if (connection->pServiceContext) { ! OCIHandleFree((dvoid *) connection->pServiceContext, (ub4) OCI_HTYPE_SVCCTX); } ! if (connection->pError) { ! OCIHandleFree((dvoid *) connection->pError, (ub4) OCI_HTYPE_ERROR); } ! efree(connection); } /* }}} */ *************** *** 684,690 **** /************************* INTERNAL FUNCTIONS *************************/ /* {{{ oci8_debugcol() */ ! static void oci8_debugcol(oci8_out_column *column,const char *format,...) { OCI8_TLS_VARS; --- 652,658 ---- /************************* INTERNAL FUNCTIONS *************************/ /* {{{ oci8_debugcol() */ ! #if 0 static void oci8_debugcol(oci8_out_column *column,const char *format,...) { OCI8_TLS_VARS; *************** *** 707,713 **** } } } ! /* }}} */ /* {{{ oci8_debug() */ --- 675,681 ---- } } } ! #endif /* }}} */ /* {{{ oci8_debug() */ *************** *** 730,753 **** } /* }}} */ - /* {{{ oci8_get_server() */ - - static oci8_server * - oci8_get_server(int server_ind, const char *func, HashTable *list, HashTable *plist) - { - int type; - oci8_server *server; - OCI8_TLS_VARS; - - server = (oci8_server *) php3_list_find(server_ind, &type); - if (!server || !OCI8_SERVER_TYPE(type)) { - php3_error(E_WARNING, "%s: invalid server %d", func, server_ind); - return (oci8_server *)NULL; - } - return server; - } - - /* }}} */ /* {{{ oci8_get_conn() */ static oci8_connection * --- 698,703 ---- *************** *** 883,895 **** case 1406: /* ORA-01406 XXX truncated value */ /* this seems to be a BUG in oracle with 1-digit numbers */ /* ! oci8_debugcol(column,"truncated"); */ size = column->indicator - 1; /* when value is truncated indicator contains the lenght */ break; case 0: /* intact value */ ! oci8_debugcol(column,"OK"); size = column->rlen; break; --- 833,847 ---- case 1406: /* ORA-01406 XXX truncated value */ /* this seems to be a BUG in oracle with 1-digit numbers */ /* ! oci8_debugcol(column,"truncated"); */ size = column->indicator - 1; /* when value is truncated indicator contains the lenght */ break; case 0: /* intact value */ ! /* ! oci8_debugcol(column,"OK"); ! */ size = column->rlen; break; *************** *** 917,926 **** OCI8_TLS_VARS; statement = ecalloc(1,sizeof(oci8_statement)); ! OCIHandleAlloc(connection->pEnv, (dvoid **)&statement->pStmt, ! OCI_HTYPE_STMT, 0, NULL); ! OCIHandleAlloc(connection->pEnv, (dvoid **)&statement->pError, ! OCI_HTYPE_ERROR, 0, NULL); error = oci8_error(statement->pError, "OCIParse", OCIStmtPrepare(statement->pStmt, connection->pError, query, len, --- 869,884 ---- OCI8_TLS_VARS; statement = ecalloc(1,sizeof(oci8_statement)); ! OCIHandleAlloc(OCI8_GLOBAL(php3_oci8_module).pEnv, ! (dvoid **)&statement->pStmt, ! OCI_HTYPE_STMT, ! 0, ! NULL); ! OCIHandleAlloc(OCI8_GLOBAL(php3_oci8_module).pEnv, ! (dvoid **)&statement->pError, ! OCI_HTYPE_ERROR, ! 0, ! NULL); error = oci8_error(statement->pError, "OCIParse", OCIStmtPrepare(statement->pStmt, connection->pError, query, len, *************** *** 933,943 **** statement->conn = connection; statement->id = php3_list_insert(statement, OCI8_GLOBAL(php3_oci8_module).le_stmt); ! oci8_debug("oci8_parse \"%s\" id=%d conn=%d persistent=%d", query, statement->id, ! statement->conn->id, ! statement->conn->persistent); return statement->id; } --- 891,900 ---- statement->conn = connection; statement->id = php3_list_insert(statement, OCI8_GLOBAL(php3_oci8_module).le_stmt); ! oci8_debug("oci8_parse \"%s\" id=%d conn=%d", query, statement->id, ! statement->conn->id); return statement->id; } *************** *** 951,956 **** --- 908,914 ---- oci8_out_column *outcol; oci8_out_column column; OCIParam *param = 0; + text *colname; ub4 counter; sword error; ub2 define_type; *************** *** 1004,1010 **** statement->columns = emalloc(sizeof(HashTable)); if (!statement->columns || ! _php3_hash_init(statement->columns, 13, NULL,(void (*)(void *))oci8_free_column, 0) == FAILURE) { /* out of memory */ return 0; } --- 962,968 ---- statement->columns = emalloc(sizeof(HashTable)); if (!statement->columns || ! _php3_hash_init(statement->columns, 13, NULL,(void (*)(void *))_oci8_free_column, 0) == FAILURE) { /* out of memory */ return 0; } *************** *** 1014,1020 **** statement->pError, "OCIHandleAlloc OCI_DTYPE_PARAM", OCIHandleAlloc( ! statement->conn->pEnv, (dvoid **)&param, OCI_DTYPE_PARAM, 0, --- 972,978 ---- statement->pError, "OCIHandleAlloc OCI_DTYPE_PARAM", OCIHandleAlloc( ! OCI8_GLOBAL(php3_oci8_module).pEnv, (dvoid **)&param, OCI_DTYPE_PARAM, 0, *************** *** 1024,1030 **** } #endif OCIHandleAlloc( ! statement->conn->pEnv, (dvoid **)&param, OCI_DTYPE_PARAM, 0, --- 982,988 ---- } #endif OCIHandleAlloc( ! OCI8_GLOBAL(php3_oci8_module).pEnv, (dvoid **)&param, OCI_DTYPE_PARAM, 0, *************** *** 1110,1116 **** OCIAttrGet( (dvoid *)param, OCI_DTYPE_PARAM, ! (dvoid **)&outcol->name, /* XXX this string is NOT zero terminated!!!! */ (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->pError)); --- 1068,1074 ---- OCIAttrGet( (dvoid *)param, OCI_DTYPE_PARAM, ! (dvoid **)&colname, /* XXX this string is NOT zero terminated!!!! */ (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->pError)); *************** *** 1118,1123 **** --- 1076,1083 ---- return 0; /* XXX we loose memory!!! */ } + outcol->name = estrndup(colname,outcol->name_len); + /* Remember the size Oracle told us, we have to increase the * storage size for some types. */ *************** *** 1368,1374 **** descr.type = OCI_DTYPE_LOB; } ! OCIDescriptorAlloc(outcol->statement->conn->pEnv,(dvoid *)&(descr.ocidescr), descr.type, (size_t) 0, (dvoid **) 0); _php3_hash_index_update(outcol->statement->conn->descriptors, outcol->statement->conn->descriptors_count,&descr,sizeof(oci8_descriptor),(void **)&pdescr); --- 1328,1334 ---- descr.type = OCI_DTYPE_LOB; } ! OCIDescriptorAlloc(OCI8_GLOBAL(php3_oci8_module).pEnv,(dvoid *)&(descr.ocidescr), descr.type, (size_t) 0, (dvoid **) 0); _php3_hash_index_update(outcol->statement->conn->descriptors, outcol->statement->conn->descriptors_count,&descr,sizeof(oci8_descriptor),(void **)&pdescr); *************** *** 1532,1547 **** } /* }}} */ ! /* {{{ oci8_open() */ ! static oci8_session *oci8_open(oci8_server* server,char *username,char *password,int persistent,HashTable *list, HashTable *plist) { sword error; ! oci8_session *session; OCISvcCtx *svchp = 0; OCI8_TLS_VARS; if (persistent) { session = calloc(1,sizeof(oci8_session)); } else { --- 1492,1541 ---- } /* }}} */ ! /* {{{ oci8_login() */ ! static oci8_session *oci8_login(oci8_server* server,char *username,char *password,int persistent,HashTable *list, HashTable *plist) { 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; + /* + check if we already have this user authenticated + + 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_length = sizeof("oci8_user_")-1 + + strlen(SAFE_STRING(username))+ + strlen(SAFE_STRING(password))+ + strlen(SAFE_STRING(server->dbname)); + hashed_details = (char *) emalloc(hashed_details_length+1); + sprintf(hashed_details,"oci8_user_%s%s%s", + SAFE_STRING(username), + 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 { *************** *** 1562,1568 **** 0, NULL); if (error != OCI_SUCCESS) { ! oci8_error(server->pError, "oci8_open: OCIHandleAlloc OCI_HTYPE_SVCCTX", error); goto CLEANUP; } --- 1556,1562 ---- 0, NULL); if (error != OCI_SUCCESS) { ! oci8_error(server->pError, "oci8_login: OCIHandleAlloc OCI_HTYPE_SVCCTX", error); goto CLEANUP; } *************** *** 1573,1579 **** 0, NULL); if (error != OCI_SUCCESS) { ! oci8_error(server->pError, "oci8_open: OCIHandleAlloc OCI_HTYPE_ERROR", error); goto CLEANUP; } --- 1567,1573 ---- 0, NULL); if (error != OCI_SUCCESS) { ! oci8_error(server->pError, "oci8_login: OCIHandleAlloc OCI_HTYPE_ERROR", error); goto CLEANUP; } *************** *** 1584,1590 **** 0, NULL); if (error != OCI_SUCCESS) { ! oci8_error(server->pError, "oci8_open: OCIHandleAlloc OCI_HTYPE_SESSION", error); goto CLEANUP; } --- 1578,1584 ---- 0, NULL); if (error != OCI_SUCCESS) { ! oci8_error(server->pError, "oci8_login: OCIHandleAlloc OCI_HTYPE_SESSION", error); goto CLEANUP; } *************** *** 1596,1602 **** OCI_ATTR_SERVER, session->pError); if (error != OCI_SUCCESS) { ! oci8_error(session->pError, "oci8_open: OCIAttrSet OCI_ATTR_SERVER", error); goto CLEANUP; } --- 1590,1596 ---- OCI_ATTR_SERVER, session->pError); if (error != OCI_SUCCESS) { ! oci8_error(session->pError, "oci8_login: OCIAttrSet OCI_ATTR_SERVER", error); goto CLEANUP; } *************** *** 1637,1653 **** /* Free Temporary Service Context */ OCIHandleFree((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX); if (persistent) { session->id = php3_list_insert(session, OCI8_GLOBAL(php3_oci8_module).le_psession); } else { session->id = php3_list_insert(session, OCI8_GLOBAL(php3_oci8_module).le_session); } return session; CLEANUP: if (session) { ! oci8_close(session); } efree(session); --- 1631,1671 ---- /* 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; CLEANUP: + if (hashed_details) { + efree(hashed_details); + } + if (session) { ! _oci8_logoff(session); } efree(session); *************** *** 1656,1669 **** } /* }}} */ ! /* {{{ oci8_close() */ ! static int oci8_close(oci8_session *session) { ! oci8_debug("oci8_close"); ! return 0; } /* }}} */ --- 1674,1690 ---- } /* }}} */ ! /* {{{ _oci8_logoff() */ ! static void ! _oci8_logoff(oci8_session *session) { ! if (! session) { ! return; ! } ! oci8_debug("_oci8_logoff: sess=%d",session->id); } /* }}} */ *************** *** 1671,1682 **** */ static oci8_server *oci8_attach(char *dbname,int persistent,HashTable *list, HashTable *plist) { ! oci8_server *server; sword error; OCI8_TLS_VARS; ! /* XXX check if we already have this server open */ if (persistent) { server = calloc(1,sizeof(oci8_server)); } else { --- 1692,1730 ---- */ 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; OCI8_TLS_VARS; ! /* ! check if we already have this server open + we will reuse servers within a request no matter if the usere requested persistent + connections or not! + + but only as pesistent requested connections will be kept between requests! + */ + + hashed_details_length = sizeof("oci8_server_")-1 + strlen(SAFE_STRING((char *)dbname)); + 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 { *************** *** 1688,1693 **** --- 1736,1743 ---- } server->persistent = persistent; + + strcpy(server->dbname,dbname); OCIHandleAlloc(OCI8_GLOBAL(php3_oci8_module).pEnv, (dvoid **)&server->pError, *************** *** 1712,1744 **** goto CLEANUP; } if (persistent) { ! server->id = php3_list_insert(server, OCI8_GLOBAL(php3_oci8_module).le_pserver); ! } else { ! server->id = php3_list_insert(server, OCI8_GLOBAL(php3_oci8_module).le_server); } ! oci8_debug("oci8_attach"); return server; CLEANUP: if (server) { ! oci8_detach(server); } return 0; } /* }}} */ ! /* {{{ oci8_detach() */ ! static int oci8_detach(oci8_server *server) { ! oci8_debug("oci8_detach"); ! return 0; } /* }}} */ --- 1762,1819 ---- 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: + if (hashed_details) { + efree(hashed_details); + } + 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); } /* }}} */ *************** *** 1749,1973 **** { text *username, *password, *dbname; pval *userParam, *passParam, *dbParam; ! ub4 username_len, password_len, dbname_len; oci8_connection *connection = 0; sword error; - char *hashed_details; - int hashed_details_length; OCI8_TLS_VARS; if (getParameters(ht, 3, &userParam, &passParam, &dbParam) == SUCCESS) { convert_to_string(userParam); convert_to_string(passParam); convert_to_string(dbParam); username = userParam->value.str.val; password = passParam->value.str.val; dbname = dbParam->value.str.val; - dbname_len = dbParam->value.str.len; } else if (getParameters(ht, 2, &userParam, &passParam) == SUCCESS) { convert_to_string(userParam); convert_to_string(passParam); username = userParam->value.str.val; password = passParam->value.str.val; ! dbname = (text *)NULL; ! dbname_len = 0; } else { WRONG_PARAM_COUNT; } ! hashed_details_length = sizeof("oci8___")-1 + ! strlen(SAFE_STRING((char *)username))+ ! strlen(SAFE_STRING((char *)password))+ ! strlen(SAFE_STRING((char *)dbname)); ! ! hashed_details = (char *) emalloc(hashed_details_length+1); ! sprintf(hashed_details,"oci8_%s_%s_%s", ! SAFE_STRING((char *)username), ! SAFE_STRING((char *)password), ! SAFE_STRING((char *)dbname)); ! if (!OCI8_GLOBAL(php3_oci8_module).allow_persistent) { ! persistent=0; } - - if (persistent) { - list_entry *le; - - if (_php3_hash_find(plist, hashed_details, hashed_details_length+1, (void **) &le)==SUCCESS) { - /* got you!!! */ - - if (le->type != OCI8_GLOBAL(php3_oci8_module).le_pconn) { - goto CLEANUP; - } - - /* XXX we should do something like an ping here to check for dead connections!!! */ ! connection = (oci8_connection *) le->ptr; ! oci8_debug("oci8_do_connect: persistent connection id=%d",connection->id); ! ! efree(hashed_details); ! ! RETURN_LONG(connection->id); ! } else { ! if (OCI8_GLOBAL(php3_oci8_module).max_links!=-1 && ! OCI8_GLOBAL(php3_oci8_module).num_links>=OCI8_GLOBAL(php3_oci8_module).max_links) { ! php3_error(E_WARNING,"OCI8: Too many open links (%d)",OCI8_GLOBAL(php3_oci8_module).num_links); ! goto CLEANUP; ! } ! if (OCI8_GLOBAL(php3_oci8_module).max_persistent!=-1 && ! OCI8_GLOBAL(php3_oci8_module).num_persistent>=OCI8_GLOBAL(php3_oci8_module).max_persistent) { ! php3_error(E_WARNING,"OCI8: Too many open persistent links (%d)", ! OCI8_GLOBAL(php3_oci8_module).num_persistent); ! goto CLEANUP; ! } ! ! /* fall thru an go ahead */ ! } ! } ! ! username_len = userParam->value.str.len; ! password_len = passParam->value.str.len; ! ! if (persistent) { ! connection = (oci8_connection *) calloc(1,sizeof(oci8_connection)); ! } else { ! connection = (oci8_connection *) ecalloc(1,sizeof(oci8_connection)); ! } ! ! if (connection == NULL) { ! RETURN_OUT_OF_MEMORY; } ! connection->persistent = persistent; ! ! /* Set up the Oracle environment. */ ! /* OCI_OBJECT is not supported as of now, but it should not harm!! */ ! ! OCIEnvInit(&connection->pEnv, OCI_DEFAULT, 0, NULL); ! ! OCIHandleAlloc(connection->pEnv, (dvoid **)&connection->pServiceContext, OCI_HTYPE_SVCCTX, 0, NULL); ! OCIHandleAlloc(connection->pEnv, (dvoid **)&connection->pError, OCI_HTYPE_ERROR, 0, NULL); ! OCIHandleAlloc(connection->pEnv, (dvoid **)&connection->pServer, OCI_HTYPE_SERVER, 0, NULL); ! OCIHandleAlloc(connection->pEnv, (dvoid **)&connection->pSession, OCI_HTYPE_SESSION, 0, NULL); ! ! error = OCIServerAttach(connection->pServer, ! connection->pError, ! dbname, ! dbname_len, ! (ub4) OCI_DEFAULT); ! if (error) { ! oci8_error(connection->pError, "OCIServerAttach", error); ! RETURN_FALSE; ! } ! error = OCIAttrSet((dvoid *) connection->pSession, ! (ub4) OCI_HTYPE_SESSION, ! (dvoid *) username, ! (ub4) username_len, ! (ub4) OCI_ATTR_USERNAME, ! connection->pError); ! if (error) { ! oci8_error(connection->pError, "OCIAttrSet OCI_ATTR_USERNAME", error); goto CLEANUP; } ! error = OCIAttrSet((dvoid *) connection->pSession, ! (ub4) OCI_HTYPE_SESSION, ! (dvoid *) password, ! (ub4) password_len, ! (ub4) OCI_ATTR_PASSWORD, ! connection->pError); ! if (error) { ! oci8_error(connection->pError, "OCIAttrSet OCI_ATTR_PASSWORD", error); ! goto CLEANUP; ! } ! error = OCIAttrSet((dvoid *)connection->pServiceContext, ! (ub4) OCI_HTYPE_SVCCTX, ! (dvoid *) connection->pServer, ! (ub4) 0, ! (ub4) OCI_ATTR_SERVER, ! connection->pError); ! if (error) { ! oci8_error(connection->pError, "OCIAttrSet OCI_ATTR_SERVER", error); goto CLEANUP; } ! error = OCISessionBegin(connection->pServiceContext, ! connection->pError, ! connection->pSession, ! (ub4) OCI_CRED_RDBMS, ! (ub4) OCI_DEFAULT); ! if (error) { ! oci8_error(connection->pError, "OCISessionBegin", error); goto CLEANUP; } ! error = OCIAttrSet((dvoid *)connection->pServiceContext, ! (ub4) OCI_HTYPE_SVCCTX, ! (dvoid *) connection->pSession, ! (ub4) 0, ! (ub4) OCI_ATTR_SESSION, connection->pError); ! if (error) { ! oci8_error(connection->pError, "OCIAttrSet OCI_ATTR_SESSION", error); goto CLEANUP; } - - connection->open = 1; - - if (persistent) { - connection->descriptors = malloc(sizeof(HashTable)); - } else { - connection->descriptors = emalloc(sizeof(HashTable)); - } ! if (!connection->descriptors || ! _php3_hash_init(connection->descriptors, 13, NULL,(void (*)(void *))oci8_free_descr, 0) == FAILURE) { ! /* out of memory */ goto CLEANUP; } - - OCI8_GLOBAL(php3_oci8_module).num_links++; - - /* non persistent, simply add to list */ - if (persistent) { - list_entry new_le; - - new_le.type = OCI8_GLOBAL(php3_oci8_module).le_pconn; - new_le.ptr = connection; ! if (_php3_hash_update(plist, hashed_details, hashed_details_length+1, ! (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) { ! /* XXX close connection here */ ! goto CLEANUP; ! } ! OCI8_GLOBAL(php3_oci8_module).num_persistent++; ! ! connection->id = php3_list_insert(connection, OCI8_GLOBAL(php3_oci8_module).le_pconn); ! } else { ! connection->id = php3_list_insert(connection, OCI8_GLOBAL(php3_oci8_module).le_conn); ! } ! oci8_debug("OCILogon: new connection id=%d persistent=%d",connection->id,connection->persistent); - efree(hashed_details); - - OCI8_GLOBAL(php3_oci8_module).num_links++; - RETURN_LONG(connection->id); ! CLEANUP: - if (hashed_details) { - efree(hashed_details); - } - - if (connection) { - oci8_close_conn(connection); - } - RETURN_FALSE; } --- 1824,1932 ---- { text *username, *password, *dbname; pval *userParam, *passParam, *dbParam; ! oci8_server *server = 0; ! oci8_session *session = 0; 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); convert_to_string(dbParam); + username = userParam->value.str.val; password = passParam->value.str.val; dbname = dbParam->value.str.val; } else if (getParameters(ht, 2, &userParam, &passParam) == SUCCESS) { convert_to_string(userParam); convert_to_string(passParam); + username = userParam->value.str.val; password = passParam->value.str.val; ! dbname = (text *)""; } else { WRONG_PARAM_COUNT; } ! connection = (oci8_connection *) ecalloc(1,sizeof(oci8_connection)); ! if (! connection) { ! goto CLEANUP; } ! server = oci8_attach(dbname,persistent,list,plist); ! if (! server) { ! goto CLEANUP; } ! persistent = server->persistent; /* if our server-context is not persistent we can't */ ! session = oci8_login(server,username,password,persistent,list,plist); ! if (! session) { goto CLEANUP; } ! persistent = session->persistent; /* if our session-context is not persistent we can't */ ! /* set our session */ ! connection->session = session; ! ! /* allocate our private error-handle */ ! error = OCIHandleAlloc(OCI8_GLOBAL(php3_oci8_module).pEnv, ! (dvoid **)&connection->pError, ! OCI_HTYPE_ERROR, ! 0, ! NULL); ! if (error != OCI_SUCCESS) { ! oci8_error(server->pError, "oci8_do_connect: OCIHandleAlloc OCI_HTYPE_ERROR", error); goto CLEANUP; } ! /* allocate our service-context */ ! error = OCIHandleAlloc(OCI8_GLOBAL(php3_oci8_module).pEnv, ! (dvoid **)&connection->pServiceContext, ! OCI_HTYPE_SVCCTX, ! 0, ! NULL); ! if (error != OCI_SUCCESS) { ! oci8_error(connection->pError, "oci8_do_connect: OCIHandleAlloc OCI_HTYPE_SVCCTX", error); goto CLEANUP; } ! /* Set the server handle in service handle */ ! error = OCIAttrSet(connection->pServiceContext, ! OCI_HTYPE_SVCCTX, ! server->pServer, ! 0, ! OCI_ATTR_SERVER, connection->pError); ! if (error != OCI_SUCCESS) { ! oci8_error(connection->pError, "oci8_do_connect: OCIAttrSet OCI_ATTR_SERVER", error); goto CLEANUP; } ! /* Set the Authentication handle in the service handle */ ! error = OCIAttrSet(connection->pServiceContext, ! OCI_HTYPE_SVCCTX, ! session->pSession, ! 0, ! OCI_ATTR_SESSION, ! connection->pError); ! if (error != OCI_SUCCESS) { ! oci8_error(connection->pError, "oci8_do_connect: OCIAttrSet OCI_ATTR_SESSION", error); goto CLEANUP; } ! connection->id = php3_list_insert(connection, OCI8_GLOBAL(php3_oci8_module).le_conn); ! oci8_debug("oci8_do_connect: id=%d",connection->id); RETURN_LONG(connection->id); ! CLEANUP: RETURN_FALSE; } *************** *** 2361,2367 **** RETURN_FALSE; } ! ociresult = OCIDescriptorAlloc(connection->pEnv,(dvoid*)&(descr.ocidescr), descr.type, (size_t) 0, (dvoid **) 0); if (ociresult) { oci8_error(connection->pError,"OCIDescriptorAlloc %d",ociresult); --- 2320,2326 ---- RETURN_FALSE; } ! ociresult = OCIDescriptorAlloc(OCI8_GLOBAL(php3_oci8_module).pEnv,(dvoid*)&(descr.ocidescr), descr.type, (size_t) 0, (dvoid **) 0); if (ociresult) { oci8_error(connection->pError,"OCIDescriptorAlloc %d",ociresult); *************** *** 2701,2707 **** ub4 nrows = 1; int i; int mode = OCI_NUM; - char namebuf[ 128 ]; OCI8_TLS_VARS; if (getParameters(ht, 3, &stmt, &array, &fmode) == SUCCESS) { --- 2660,2665 ---- *************** *** 2757,2767 **** } if (mode & OCI_ASSOC) { - memcpy(namebuf,column->name, column->name_len); - namebuf[ column->name_len ] = 0; - oci8_make_pval(&element,stmt->value.lval,column, "OCIFetchInto",list,mode); ! _php3_hash_update(array->value.ht, namebuf, column->name_len+1, (void *)&element, sizeof(pval), NULL); } } --- 2715,2722 ---- } if (mode & OCI_ASSOC) { oci8_make_pval(&element,stmt->value.lval,column, "OCIFetchInto",list,mode); ! _php3_hash_update(array->value.ht, column->name, column->name_len+1, (void *)&element, sizeof(pval), NULL); } } *************** *** 2886,2892 **** RETURN_FALSE; } ! if (! OCI8_CONN_TYPE(index_t) && ! OCI8_PCONN_TYPE(index_t)) { oci8_debug("OCILogoff: connection not found..."); RETURN_FALSE; } --- 2841,2847 ---- RETURN_FALSE; } ! if (! OCI8_CONN_TYPE(index_t)) { oci8_debug("OCILogoff: connection not found..."); RETURN_FALSE; } *************** *** 2897,3005 **** oci8_debug("OCILogoff: php3_list_delete failed."); RETURN_FALSE; } - } - - /* }}} */ - /* {{{ proto int OCIAttach(string $dbname) - */ - void php3_oci8_attach(INTERNAL_FUNCTION_PARAMETERS) - { - pval *dbname; - oci8_server *server; - OCI8_TLS_VARS; - - if (getParameters(ht, 1, &dbname) == SUCCESS) { - convert_to_string(dbname); - server = oci8_attach(dbname->value.str.val,0,list,plist); - } else { - server = oci8_attach("",0,list,plist); - } - - if (server) { - RETURN_LONG(server->id); - } else { - RETURN_FALSE; - } - } - - /* }}} */ - /* {{{ proto int OCIDetach(int server) - */ - - void php3_oci8_detach(INTERNAL_FUNCTION_PARAMETERS) - { - } - - /* }}} */ - /* {{{ proto int OCIPAttach(string $dbname) - */ - void php3_oci8_pattach(INTERNAL_FUNCTION_PARAMETERS) - { - pval *dbname; - oci8_server *server; - OCI8_TLS_VARS; - - if (getParameters(ht, 1, &dbname) == SUCCESS) { - convert_to_string(dbname); - server = oci8_attach(dbname->value.str.val,1,list,plist); - } else { - server = oci8_attach("",1,list,plist); - } - - if (server) { - RETURN_LONG(server->id); - } else { - RETURN_FALSE; - } - } - - /* }}} */ - /* {{{ proto int OCIOpen(string user, string pass) - */ - - void php3_oci8_open(INTERNAL_FUNCTION_PARAMETERS) - { - pval *serverParam, *userParam, *passParam; - oci8_session *session; - oci8_server *server; - OCI8_TLS_VARS; - - - if (getParameters(ht, 3, &serverParam, &userParam, &passParam) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(serverParam); - convert_to_string(userParam); - convert_to_string(passParam); - - server = oci8_get_server(serverParam->value.lval,"php3_oci8_open",list,plist); - if (! server) { - RETURN_FALSE; - } - - - session = oci8_open(server, - userParam->value.str.val, - passParam->value.str.val, - 0, - list, - plist); - - - if (session) { - RETURN_LONG(session->id); - } else { - RETURN_FALSE; - } - } - - /* }}} */ - /* {{{ proto int OCIClose(int $session) - */ - - void php3_oci8_close(INTERNAL_FUNCTION_PARAMETERS) - { } /* }}} */ --- 2852,2857 ---- Index: php3/functions/php3_oci8.h diff -c php3/functions/php3_oci8.h:1.36 php3/functions/php3_oci8.h:1.37 *** php3/functions/php3_oci8.h:1.36 Wed Apr 7 08:10:15 1999 --- php3/functions/php3_oci8.h Wed Apr 7 12:30:01 1999 *************** *** 51,66 **** # include <oci.h> - typedef enum { - OCI8_SERVER=1, - OCI8_SESSION, - OCI8_SERVICE, - OCI8_STATEMENT - } php3_oci8_type; - typedef struct { int id; int persistent; OCIError *pError; OCIServer *pServer; } oci8_server; --- 51,60 ---- # include <oci.h> typedef struct { int id; int persistent; + char dbname[ 64 ]; OCIError *pError; OCIServer *pServer; } oci8_server; *************** *** 75,97 **** typedef struct { int id; - oci8_server *server; oci8_session *session; - OCIError *pError; - OCISvcCtx *pService; - } oci8_service; - - typedef struct { - int id; - int persistent; - OCIEnv *pEnv; - OCIServer *pServer; OCISvcCtx *pServiceContext; OCIError *pError; - OCISession *pSession; HashTable *descriptors; int descriptors_count; - int open; } oci8_connection; typedef struct { --- 69,79 ---- *************** *** 107,113 **** char *data; /* for pval cache */ } oci8_define; - typedef struct { int id; oci8_connection *conn; --- 89,94 ---- *************** *** 133,139 **** typedef struct { oci8_statement *statement; OCIDefine *pDefine; ! text *name; ub4 name_len; ub2 type; ub4 size4; --- 114,120 ---- typedef struct { oci8_statement *statement; OCIDefine *pDefine; ! char *name; ub4 name_len; ub2 type; ub4 size4; *************** *** 149,167 **** oci8_define *define; } oci8_out_column; - typedef union { - oci8_server server; - oci8_session session; - oci8_service service; - } oci8_structs; - typedef struct { - php3_oci8_type type; - int id; - oci8_structs s; - } oci8_struct; - - typedef struct { OCIError *pError; char *default_username; char *default_password; --- 130,136 ---- *************** *** 175,189 **** long num_persistent; long num_links; ! int le_conn; ! int le_pconn; ! int le_stmt; ! int le_server; ! int le_pserver; ! int le_session; ! int le_psession; OCIEnv *pEnv; } oci8_module; --- 144,157 ---- long num_persistent; long num_links; ! 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; *************** *** 196,205 **** /* 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_CONN_TYPE(x) (((x)==OCI8_GLOBAL(php3_oci8_module).le_conn) || ((x)==OCI8_GLOBAL(php3_oci8_module).le_pconn)) ! # define OCI8_PCONN_TYPE(x) ((x)==OCI8_GLOBAL(php3_oci8_module).le_pconn) # define OCI8_STMT_TYPE(x) ((x)==OCI8_GLOBAL(php3_oci8_module).le_stmt) - # define OCI8_DESCR_TYPE(x) ((x)==OCI8_GLOBAL(php3_oci8_module).le_descr) # define RETURN_OUT_OF_MEMORY \ php3_error(E_WARNING, "Out of memory");\ --- 164,173 ---- /* 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) # define RETURN_OUT_OF_MEMORY \ php3_error(E_WARNING, "Out of memory");\ *************** *** 207,216 **** # define OCI8_FAIL(c,f,r) \ php3i_oci8_error((c)->pError,(f),(r));\ RETURN_FALSE - - void php3_oci_logon(INTERNAL_FUNCTION_PARAMETERS); - void php3_oci_plogon(INTERNAL_FUNCTION_PARAMETERS); - void php3_oci_do_logon(INTERNAL_FUNCTION_PARAMETERS, int persistent); #else /* !HAVE_OCI8 */ --- 175,180 ---- -- 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 (#4976) next »