CVS update: php31/ext/oracle
| From: | shane | Date: | Sat, 17 Oct 1998 21:15:32 +0000 |
| Subject: | CVS update: php31/ext/oracle | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1893@lists.php.net to get a copy of this message | ||
Date: Saturday October 17, 1998 @ 17:15
Author: shane
Update of /repository/php31/ext/oracle
In directory asf:/u2/tmp/cvs-serv223/ext/oracle
Modified Files:
oracle.c
Added Files:
oracle_hack.c
Log Message:
make oracle compilable on both 3.0 and 3.1
Index: php31/ext/oracle/oracle.c
diff -c php31/ext/oracle/oracle.c:2.4 php31/ext/oracle/oracle.c:2.5
*** php31/ext/oracle/oracle.c:2.4 Sat Oct 17 16:45:38 1998
--- php31/ext/oracle/oracle.c Sat Oct 17 17:15:31 1998
***************
*** 30,36 ****
+----------------------------------------------------------------------+
*/
#if defined(COMPILE_DL)
! #include "dl/phpdl.h"
#endif
#include "php.h"
#include "internal_functions.h"
--- 30,43 ----
+----------------------------------------------------------------------+
*/
#if defined(COMPILE_DL)
! # if PHP_31
! # include "../phpdl.h"
! # else
! # ifdef THREAD_SAFE
! # undef THREAD_SAFE
! # endif
! # include "dl/phpdl.h"
! # endif
#endif
#include "php.h"
#include "internal_functions.h"
***************
*** 162,192 ****
#if COMPILE_DL
DLEXPORT php3_module_entry *get_module() { return &oracle_module_entry; };
- #if (WIN32|WINNT) && defined(THREAD_SAFE)
-
- /* NOTE: You should have an oracle.def file where you export DllMain */
- BOOL WINAPI DllMain(HANDLE hModule, DWORD ul_reason_for_call,
- LPVOID lpReserved)
- {
- switch (ul_reason_for_call) {
- case DLL_PROCESS_ATTACH:
- if ((ORACLETls = TlsAlloc()) == 0xFFFFFFFF){
- return 0;
- }
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- break;
- case DLL_PROCESS_DETACH:
- if (!TlsFree(ORACLETls)){
- return 0;
- }
- break;
- }
- return 1;
- }
- #endif
#endif
static int _cursors_cleanup(list_entry *le)
--- 169,174 ----
***************
*** 263,288 ****
int php3_minit_oracle(INIT_FUNC_ARGS)
{
! #ifdef THREAD_SAFE
oracle_global_struct *oracle_globals;
! #if !COMPILE_DL
! #if WIN32|WINNT
! CREATE_MUTEX(oracle_mutex,"ORACLE_TLS");
! #endif
! #endif
! #if !COMPILE_DL
! SET_MUTEX(oracle_mutex);
numthreads++;
if (numthreads==1){
! if ((ORACLETls=TlsAlloc())==0xFFFFFFFF){
! FREE_MUTEX(oracle_mutex);
! return 0;
! }}
! FREE_MUTEX(oracle_mutex);
! #endif
! oracle_globals =
! (oracle_global_struct *) LocalAlloc(LPTR, sizeof(oracle_global_struct));
! TlsSetValue(ORACLETls, (void *) oracle_globals);
#endif
ORACLE_GLOBAL(php3_oracle_module).le_conn =
--- 245,267 ----
int php3_minit_oracle(INIT_FUNC_ARGS)
{
! #if defined(THREAD_SAFE)
oracle_global_struct *oracle_globals;
! PHP3_MUTEX_ALLOC(oracle_mutex);
! PHP3_MUTEX_LOCK(oracle_mutex);
numthreads++;
if (numthreads==1){
! if (!PHP3_TLS_PROC_STARTUP(ORACLETls)){
! PHP3_MUTEX_UNLOCK(oracle_mutex);
! PHP3_MUTEX_FREE(oracle_mutex);
! return FAILURE;
! }
! }
! PHP3_MUTEX_UNLOCK(oracle_mutex);
! if(!PHP3_TLS_THREAD_INIT(ORACLETls,oracle_globals,oracle_global_struct)){
! PHP3_MUTEX_FREE(oracle_mutex);
! return FAILURE;
! }
#endif
ORACLE_GLOBAL(php3_oracle_module).le_conn =
***************
*** 339,361 ****
int php3_mshutdown_oracle(void)
{
#ifdef THREAD_SAFE
! oracle_global_struct *oracle_globals;
! oracle_globals = TlsGetValue(ORACLETls);
! if (oracle_globals != 0) {
! LocalFree((HLOCAL) oracle_globals);
! }
! #if !COMPILE_DL
! SET_MUTEX(oracle_mutex);
numthreads--;
! if (!numthreads) {
! if (!TlsFree(ORACLETls)) {
! FREE_MUTEX(oracle_mutex);
! return 0;
! }
}
! FREE_MUTEX(oracle_mutex);
! #endif
#endif
return SUCCESS;
--- 318,335 ----
int php3_mshutdown_oracle(void)
{
+ ORACLE_TLS_VARS;
#ifdef THREAD_SAFE
! PHP3_TLS_THREAD_FREE(oracle_globals);
! PHP3_MUTEX_LOCK(oracle_mutex);
numthreads--;
! if (numthreads<1) {
! PHP3_TLS_PROC_SHUTDOWN(ORACLETls);
! PHP3_MUTEX_UNLOCK(oracle_mutex);
! PHP3_MUTEX_FREE(oracle_mutex);
! return SUCCESS;
}
! PHP3_MUTEX_UNLOCK(oracle_mutex);
#endif
return SUCCESS;
***************
*** 488,494 ****
--- 462,472 ----
return_value->value.lval =
php3_plist_insert(db_conn, ORACLE_GLOBAL(php3_oracle_module).le_pconn);
new_index_ptr.ptr = (void *) return_value->value.lval;
+ #ifdef THREAD_SAFE
+ new_index_ptr.type = _php3_le_index_ptr();
+ #else
new_index_ptr.type = le_index_ptr;
+ #endif
if (_php3_hash_update(plist,hashed_details,hashed_len + 1,(void *) &new_index_ptr,
sizeof(list_entry),NULL) == FAILURE) {
ologof(&db_conn->lda);
***************
*** 510,516 ****
--- 488,498 ----
int type;
/* the link is already in the persistent list */
+ #ifdef THREAD_SAFE
+ if (index_ptr->type != _php3_le_index_ptr()) {
+ #else
if (index_ptr->type != le_index_ptr) {
+ #endif
efree(hashed_details);
php3_error(E_WARNING, "Oops, something went completly wrong");
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