[PHP-DEV] cvs: /php3 ChangeLog /php3/functions oci8.c php3_oci8.h From: Thies C. Arntzen (thies <email protected>)
Date: 09/29/99

thies Wed Sep 29 10:31:45 1999 EDT

  Modified files:
    /php3 ChangeLog
    /php3/functions oci8.c php3_oci8.h
  Log:
  Fixed LOB/Persistent-Connection related OCI8-Crash
  
  
Index: php3/ChangeLog
diff -u php3/ChangeLog:1.775 php3/ChangeLog:1.776
--- php3/ChangeLog:1.775 Tue Sep 28 13:51:56 1999
+++ php3/ChangeLog Wed Sep 29 10:31:43 1999
@@ -2,6 +2,7 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
 ???? ??, 1999, Version 3.0.13
+- Fixed LOB/Persistent-Connection related OCI8-Crash (Thies)
 - Added a function for applying a gamma correction to a GD image
   Example: imagegammacorrect($im,1.8,2.2); (markonen)
 - Added a function for applying a gamma correction to a HTML color value
Index: php3/functions/oci8.c
diff -u php3/functions/oci8.c:1.125 php3/functions/oci8.c:1.126
--- php3/functions/oci8.c:1.125 Fri Sep 17 04:18:37 1999
+++ php3/functions/oci8.c Wed Sep 29 10:31:43 1999
@@ -33,7 +33,7 @@
 
 #define OCI8_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */
 
-/* $Id: oci8.c,v 1.125 1999/09/17 08:18:37 thies Exp $ */
+/* $Id: oci8.c,v 1.126 1999/09/29 14:31:43 thies Exp $ */
 
 /* TODO list:
  *
@@ -399,6 +399,9 @@
         OCI8_GLOBAL(php3_oci8_module).server = malloc(sizeof(HashTable));
         _php3_hash_init(OCI8_GLOBAL(php3_oci8_module).server, 13, NULL, NULL, 1);
 
+ OCI8_GLOBAL(php3_oci8_module).conns= malloc(sizeof(HashTable));
+ _php3_hash_init(OCI8_GLOBAL(php3_oci8_module).conns, 13, NULL, NULL, 1);
+
         if (cfg_get_long("oci8.debug_mode",
                                          &OCI8_GLOBAL(php3_oci8_module).debug_mode) == FAILURE) {
                 OCI8_GLOBAL(php3_oci8_module).debug_mode = 0;
@@ -499,9 +502,11 @@
 
         _php3_hash_destroy(OCI8_GLOBAL(php3_oci8_module).user);
         _php3_hash_destroy(OCI8_GLOBAL(php3_oci8_module).server);
+ _php3_hash_destroy(OCI8_GLOBAL(php3_oci8_module).conns);
 
         free(OCI8_GLOBAL(php3_oci8_module).user);
         free(OCI8_GLOBAL(php3_oci8_module).server);
+ free(OCI8_GLOBAL(php3_oci8_module).conns);
 
         OCIHandleFree((dvoid *)OCI8_GLOBAL(php3_oci8_module).pEnv, OCI_HTYPE_ENV);
 
@@ -609,6 +614,8 @@
 static void
 _oci8_free_column(oci8_out_column *column)
 {
+ oci8_connection *db_conn;
+
         if (! column) {
                 return;
         }
@@ -619,7 +626,9 @@
 
         if (column->data) {
                 if (column->is_descr) {
- _php3_hash_index_del(column->statement->conn->descriptors,(int) column->data);
+ if (_php3_hash_find(OCI8_GLOBAL(php3_oci8_module).conns,(void*)&(column->statement->conn),sizeof(void*),(void **)&db_conn) == SUCCESS) {
+ _php3_hash_index_del(column->statement->conn->descriptors,(int) column->data);
+ }
                 } else {
                         if (column->data) {
                                 efree(column->data);
@@ -698,6 +707,8 @@
 
         oci8_debug("_oci8_close_conn: id=%d",connection->id);
 
+ _php3_hash_del(OCI8_GLOBAL(php3_oci8_module).conns,(void*)&connection,sizeof(void*));
+
         if (connection->descriptors) {
                 _php3_hash_destroy(connection->descriptors);
                 efree(connection->descriptors);
@@ -2254,6 +2265,8 @@
         connection->open = 1;
 
         oci8_debug("oci8_do_connect: id=%d",connection->id);
+
+ _php3_hash_add(OCI8_GLOBAL(php3_oci8_module).conns,(void*)&connection,sizeof(void*),(void*)&connection,sizeof(void*),NULL);
 
         RETURN_RESOURCE(connection->id);
         
Index: php3/functions/php3_oci8.h
diff -u php3/functions/php3_oci8.h:1.54 php3/functions/php3_oci8.h:1.55
--- php3/functions/php3_oci8.h:1.54 Mon Sep 13 11:19:28 1999
+++ php3/functions/php3_oci8.h Wed Sep 29 10:31:44 1999
@@ -166,6 +166,8 @@
         int user_num;
         HashTable *user;
 
+ HashTable *conns;
+
     OCIEnv *pEnv;
 } oci8_module;
 

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>