tony2001                Sat Aug  5 20:56:12 2006 UTC

  Modified files:              
    /php-src/ext/oci8   oci8.c 
  Log:
  fix PECL bug #7827
  add small optimization - no need to do anything if hash lookup failed, just 
move along
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8.c?r1=1.309&r2=1.310&diff_format=u
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.309 php-src/ext/oci8/oci8.c:1.310
--- php-src/ext/oci8/oci8.c:1.309       Tue Aug  1 12:08:10 2006
+++ php-src/ext/oci8/oci8.c     Sat Aug  5 20:56:12 2006
@@ -26,7 +26,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: oci8.c,v 1.309 2006/08/01 12:08:10 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.310 2006/08/05 20:56:12 tony2001 Exp $ */
 /* TODO
  *
  * file://localhost/www/docs/oci10/ociaahan.htm#423823 - implement lob_empty() 
with OCI_ATTR_LOBEMPTY
@@ -48,6 +48,7 @@
 
 #include "php_oci8.h"
 #include "php_oci8_int.h"
+#include "zend_hash.h"
 
 ZEND_DECLARE_MODULE_GLOBALS(oci)
 #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 
5)
@@ -667,7 +668,7 @@
        php_info_print_table_start();
        php_info_print_table_row(2, "OCI8 Support", "enabled");
        php_info_print_table_row(2, "Version", "1.2.1");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.309 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.310 $");
 
        sprintf(buf, "%ld", OCI_G(num_persistent));
        php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -1001,6 +1002,13 @@
        smart_str_appendl_ex(&hashed_details, "oci8___", sizeof("oci8___") - 1, 
0);
        smart_str_appendl_ex(&hashed_details, username, username_len, 0);
        smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0);
+       if (password_len) {
+               ulong password_hash;
+               password_hash = zend_inline_hash_func(password, password_len);
+               smart_str_append_unsigned_ex(&hashed_details, password_hash, 0);
+       }
+       smart_str_appendl_ex(&hashed_details, "__", sizeof("__") - 1, 0);
+
        if (dbname) {
                smart_str_appendl_ex(&hashed_details, dbname, dbname_len, 0);
        }
@@ -1037,14 +1045,17 @@
        }
        
        if (!exclusive && !new_password) {
-               
+               zend_bool found = 0;
+
                if (persistent && zend_hash_find(&EG(persistent_list), 
hashed_details.c, hashed_details.len+1, (void **) &le) == SUCCESS) {
+                       found = 1;
                        /* found */
                        if (le->type == le_pconnection) {
                                connection = (php_oci_connection *)le->ptr;     
                        }
                }
                else if (!persistent && zend_hash_find(&EG(regular_list), 
hashed_details.c, hashed_details.len+1, (void **) &le) == SUCCESS) {
+                       found = 1;
                        if (le->type == le_index_ptr) {
                                int type;
                                long link;
@@ -1106,8 +1117,7 @@
                                connection = NULL;
                                goto open;
                        }
-               }
-               else {
+               } else if (found) {
                        /* found something, but it's not a connection, delete 
it */
                        if (persistent) {
                                zend_hash_del(&EG(persistent_list), 
hashed_details.c, hashed_details.len+1);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to