CVS update: php3/functions

From: Date: Tue, 20 Apr 1999 12:10:43 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5151@lists.php.net to get a copy of this message
Date: Tuesday April 20, 1999 @ 8:10 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv23462/functions Modified Files: oci8.c Log Message: some of the reconnect core is in place. Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.82 php3/functions/oci8.c:1.83 *** php3/functions/oci8.c:1.82 Tue Apr 20 07:33:46 1999 --- php3/functions/oci8.c Tue Apr 20 08:10:42 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.82 1999/04/20 11:33:46 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.83 1999/04/20 12:10:42 thies Exp $ */ /* TODO list: * *************** *** 784,789 **** --- 784,790 ---- if (connection->open) { return connection; } else { + /* _oci8_close_conn(connection); be careful with this!! */ return (oci8_connection *)NULL; } } *************** *** 807,812 **** --- 808,814 ---- if (statement->conn->open) { return statement; } else { + /* _oci8_free_stmt(statement); be careful with this!! */ return (oci8_statement *)NULL; } } *************** *** 1684,1691 **** _php3_hash_find(OCI8_GLOBAL(php3_oci8_module).user, hashed_details, hashed_details_length+1, (void **) &session); if (session) { ! free(hashed_details); ! return session; } session = calloc(1,sizeof(oci8_session)); --- 1686,1698 ---- _php3_hash_find(OCI8_GLOBAL(php3_oci8_module).user, hashed_details, hashed_details_length+1, (void **) &session); if (session) { ! if (session->open) { ! free(hashed_details); ! return session; ! } else { ! _oci8_close_user(session); ! /* breakthru to open */ ! } } session = calloc(1,sizeof(oci8_session)); *************** *** 1797,1802 **** --- 1804,1811 ---- return session; CLEANUP: + oci8_debug("oci8_open_user: FAILURE -> CLEANUP called"); + _oci8_close_user(session); return 0; *************** *** 1818,1857 **** oci8_debug("_oci8_close_user: logging-off sess=%d user=%s",session->num,session->hashed_details); - /* 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); - } - if (session->open) { error = OCISessionEnd(svchp, session->pError, session->pSession, --- 1827,1866 ---- oci8_debug("_oci8_close_user: logging-off sess=%d user=%s",session->num,session->hashed_details); if (session->open) { + /* 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, *************** *** 1860,1869 **** oci8_error(session->pError, "_oci8_close_user: OCISessionEnd", error); } } else { ! oci8_debug("_oci8_close_user: Session was marked DEAD"); } - OCIHandleFree((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX); if (session->pSession) --- 1869,1877 ---- oci8_error(session->pError, "_oci8_close_user: OCISessionEnd", error); } } else { ! oci8_debug("_oci8_close_user: logging-off DEAD session"); } OCIHandleFree((dvoid *) svchp, (ub4) OCI_HTYPE_SVCCTX); if (session->pSession) *************** *** 1921,1934 **** _php3_hash_find(OCI8_GLOBAL(php3_oci8_module).server, hashed_details, hashed_details_length+1, (void **) &server); if (server) { ! free(hashed_details); ! ! /* if our new users uses this connection persistent, we're keeping it! */ ! if (persistent) { ! server->persistent = persistent; } - - return server; } server = calloc(1,sizeof(oci8_server)); --- 1929,1947 ---- _php3_hash_find(OCI8_GLOBAL(php3_oci8_module).server, hashed_details, hashed_details_length+1, (void **) &server); if (server) { ! if (server->open) { ! free(hashed_details); ! ! /* if our new users uses this connection persistent, we're keeping it! */ ! if (persistent) { ! server->persistent = persistent; ! } ! ! return server; ! } else { /* server "died" in the meantime - try to reconnect! */ ! _oci8_close_server(server); ! /* breakthru to open */ } } server = calloc(1,sizeof(oci8_server)); *************** *** 1998,2003 **** --- 2011,2018 ---- return server; CLEANUP: + oci8_debug("oci8_open_server: FAILURE -> CLEANUP called"); + _oci8_close_server(server); return 0; *************** *** 2021,2034 **** /* XXX close server here */ ! if (server->pServer && server->pError) { ! error = OCIServerDetach(server->pServer, ! server->pError, ! OCI_DEFAULT); ! ! if (error) { ! oci8_error(server->pError, "oci8_close_server OCIServerDetach", error); } } if (server->pServer) --- 2036,2053 ---- /* XXX close server here */ ! if (server->open) { ! if (server->pServer && server->pError) { ! error = OCIServerDetach(server->pServer, ! server->pError, ! OCI_DEFAULT); ! ! if (error) { ! oci8_error(server->pError, "oci8_close_server OCIServerDetach", error); ! } } + } else { + oci8_debug("_oci8_close_server: closind DEAD server"); } if (server->pServer) *************** *** 2150,2155 **** --- 2169,2175 ---- goto CLEANUP; } + /* OCIAttrSet((dvoid *)session->server->pServer, OCI_HTYPE_SERVER, (dvoid *) "demo", *************** *** 2163,2171 **** --- 2183,2193 ---- 0, OCI_ATTR_INTERNAL_NAME, connection->pError); + */ connection->id = php3_list_insert(connection, OCI8_GLOBAL(php3_oci8_module).le_conn); + connection->descriptors = emalloc(sizeof(HashTable)); if (!connection->descriptors || _php3_hash_init(connection->descriptors, 13, NULL,(void (*)(void *))_oci8_free_descr, 0) == FAILURE) { *************** *** 2179,2185 **** RETURN_LONG(connection->id); CLEANUP: ! _oci8_close_conn(connection); RETURN_FALSE; } --- 2201,2213 ---- RETURN_LONG(connection->id); CLEANUP: ! oci8_debug("oci8_do_connect: FAILURE -> CLEANUP called"); ! ! if (connection->id) { ! php3_list_delete(connection->id); ! } else { ! _oci8_close_conn(connection); ! } RETURN_FALSE; } -- 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 (#5151) next »