[PHP-DEV] CVS update: php31/ext/msql From: zeev (php-dev <email protected>)
Date: 06/26/98

Date: Friday June 26, 1998 @ 12:52
Author: zeev

Update of /repository/php31/ext/msql
In directory asf:/tmp/cvs-serv8683/ext/msql

Modified Files:
        msql.c
Log Message:
I doubt that's all that missing, but here it is anyway

Index: php31/ext/msql/msql.c
diff -c php31/ext/msql/msql.c:1.1.1.1 php31/ext/msql/msql.c:1.2
*** php31/ext/msql/msql.c:1.1.1.1 Tue May 26 22:26:55 1998
--- php31/ext/msql/msql.c Fri Jun 26 12:52:53 1998
***************
*** 27,33 ****
     +----------------------------------------------------------------------+
   */
   
! /* $Id: msql.c,v 1.1.1.1 1998/05/27 02:26:55 rasmus Exp $ */
  #ifdef THREAD_SAFE
  #include "tls.h"
  #endif
--- 27,33 ----
     +----------------------------------------------------------------------+
   */
   
! /* $Id: msql.c,v 1.2 1998/06/26 16:52:53 zeev Exp $ */
  #ifdef THREAD_SAFE
  #include "tls.h"
  #endif
***************
*** 320,326 ****
                  }
                  
                  /* try to find if we already have this link in our persistent list */
! if (hash_find(plist, hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
                          list_entry new_le;
                          
                          /* create the link */
--- 320,326 ----
                  }
                  
                  /* try to find if we already have this link in our persistent list */
! if (_php3_hashfind(plist, hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
                          list_entry new_le;
                          
                          /* create the link */
***************
*** 332,338 ****
                          /* hash it up */
                          new_le.type = MSQL_GLOBAL(php3_msql_module).le_plink;
                          new_le.ptr = (void *) msql;
! if (hash_update(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
                                  efree(hashed_details);
                                  RETURN_FALSE;
                          }
--- 332,338 ----
                          /* hash it up */
                          new_le.type = MSQL_GLOBAL(php3_msql_module).le_plink;
                          new_le.ptr = (void *) msql;
! if (_php3_hashupdate(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
                                  efree(hashed_details);
                                  RETURN_FALSE;
                          }
***************
*** 349,355 ****
                          if (msql_stat(le->ptr)==NULL) { /* the link died */
                                  if (msql_connect(le->ptr,host,user,passwd)==NULL) {
                                          php3_error(E_WARNING,"mSQL link lost, unable to reconnect");
! hash_del(plist,hashed_details,hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
--- 349,355 ----
                          if (msql_stat(le->ptr)==NULL) { /* the link died */
                                  if (msql_connect(le->ptr,host,user,passwd)==NULL) {
                                          php3_error(E_WARNING,"mSQL link lost, unable to reconnect");
! _php3_hashdel(plist,hashed_details,hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
***************
*** 367,373 ****
                   * if it doesn't, open a new msql link, add it to the resource list,
                   * and add a pointer to it with hashed_details as the key.
                   */
! if (hash_find(list,hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
                          int type,link;
                          void *ptr;
  
--- 367,373 ----
                   * if it doesn't, open a new msql link, add it to the resource list,
                   * and add a pointer to it with hashed_details as the key.
                   */
! if (_php3_hashfind(list,hashed_details,hashed_details_length+1,(void **) &index_ptr)==SUCCESS) {
                          int type,link;
                          void *ptr;
  
***************
*** 382,388 ****
                                  efree(hashed_details);
                                  return;
                          } else {
! hash_del(list,hashed_details,hashed_details_length+1);
                          }
                  }
                  if (MSQL_GLOBAL(php3_msql_module).max_links!=-1 && MSQL_GLOBAL(php3_msql_module).num_links>=MSQL_GLOBAL(php3_msql_module).max_links) {
--- 382,388 ----
                                  efree(hashed_details);
                                  return;
                          } else {
! _php3_hashdel(list,hashed_details,hashed_details_length+1);
                          }
                  }
                  if (MSQL_GLOBAL(php3_msql_module).max_links!=-1 && MSQL_GLOBAL(php3_msql_module).num_links>=MSQL_GLOBAL(php3_msql_module).max_links) {
***************
*** 402,408 ****
                  /* add it to the hash */
                  new_index_ptr.ptr = (void *) return_value->value.lval;
                  new_index_ptr.type = le_index_ptr;
! if (hash_update(list,hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
                          efree(hashed_details);
                          RETURN_FALSE;
                  }
--- 402,408 ----
                  /* add it to the hash */
                  new_index_ptr.ptr = (void *) return_value->value.lval;
                  new_index_ptr.type = le_index_ptr;
! if (_php3_hashupdate(list,hashed_details,hashed_details_length+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
                          efree(hashed_details);
                          RETURN_FALSE;
                  }
***************
*** 419,427 ****
          if (MSQL_GLOBAL(php3_msql_module).default_link==-1) { /* no link opened yet, implicitly open one */
                  HashTable tmp;
                  
! hash_init(&tmp,0,NULL,NULL,0);
                  php3_msql_do_connect(&tmp,return_value,list,plist,0);
! hash_destroy(&tmp);
          }
          return MSQL_GLOBAL(php3_msql_module).default_link;
  }
--- 419,427 ----
          if (MSQL_GLOBAL(php3_msql_module).default_link==-1) { /* no link opened yet, implicitly open one */
                  HashTable tmp;
                  
! _php3_hashinit(&tmp,0,NULL,NULL,0);
                  php3_msql_do_connect(&tmp,return_value,list,plist,0);
! _php3_hashdestroy(&tmp);
          }
          return MSQL_GLOBAL(php3_msql_module).default_link;
  }
***************
*** 1075,1081 ****
                  } else {
                          add_get_index_stringl(return_value, i, empty_string, 0, (void **) &yystype_ptr, 1);
                  }
! hash_pointer_update(return_value->value.ht, msql_field->name, strlen(msql_field->name)+1, yystype_ptr);
          }
  }
  
--- 1075,1081 ----
                  } else {
                          add_get_index_stringl(return_value, i, empty_string, 0, (void **) &yystype_ptr, 1);
                  }
! _php3_hashpointer_update(return_value->value.ht, msql_field->name, strlen(msql_field->name)+1, yystype_ptr);
          }
  }