tony2001                Sat Aug  5 20:56:43 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/oci8   oci8.c 
  Log:
  fix PECL bug #7827
  add small optimization
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8.c?r1=1.269.2.16.2.11&r2=1.269.2.16.2.12&diff_format=u
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.269.2.16.2.11 
php-src/ext/oci8/oci8.c:1.269.2.16.2.12
--- php-src/ext/oci8/oci8.c:1.269.2.16.2.11     Tue Aug  1 12:08:25 2006
+++ php-src/ext/oci8/oci8.c     Sat Aug  5 20:56:43 2006
@@ -26,7 +26,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: oci8.c,v 1.269.2.16.2.11 2006/08/01 12:08:25 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.12 2006/08/05 20:56:43 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)
 static PHP_GINIT_FUNCTION(oci);
@@ -652,7 +653,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.269.2.16.2.11 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.12 $");
 
        sprintf(buf, "%ld", OCI_G(num_persistent));
        php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -986,6 +987,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);
        }
@@ -1022,14 +1030,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;
@@ -1091,8 +1102,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