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

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

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

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

Index: php31/ext/mysql/mysql.c
diff -c php31/ext/mysql/mysql.c:1.2 php31/ext/mysql/mysql.c:1.3
*** php31/ext/mysql/mysql.c:1.2 Tue Jun 2 16:45:50 1998
--- php31/ext/mysql/mysql.c Fri Jun 26 12:52:55 1998
***************
*** 27,33 ****
     +----------------------------------------------------------------------+
   */
   
! /* $Id: mysql.c,v 1.2 1998/06/02 20:45:50 shane Exp $ */
  
  
  /* TODO:
--- 27,33 ----
     +----------------------------------------------------------------------+
   */
   
! /* $Id: mysql.c,v 1.3 1998/06/26 16:52:55 zeev Exp $ */
  
  
  /* TODO:
***************
*** 443,449 ****
                  list_entry *le;
                  
                  /* 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;
  
                          if (MySQL_GLOBAL(php3_mysql_module).max_links!=-1 && MySQL_GLOBAL(php3_mysql_module).num_links>=MySQL_GLOBAL(php3_mysql_module).max_links) {
--- 443,449 ----
                  list_entry *le;
                  
                  /* 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;
  
                          if (MySQL_GLOBAL(php3_mysql_module).max_links!=-1 && MySQL_GLOBAL(php3_mysql_module).num_links>=MySQL_GLOBAL(php3_mysql_module).max_links) {
***************
*** 468,474 ****
                          /* hash it up */
                          new_le.type = MySQL_GLOBAL(php3_mysql_module).le_plink;
                          new_le.ptr = mysql;
! if (hash_update(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
                                  free(mysql);
                                  efree(hashed_details);
                                  RETURN_FALSE;
--- 468,474 ----
                          /* hash it up */
                          new_le.type = MySQL_GLOBAL(php3_mysql_module).le_plink;
                          new_le.ptr = mysql;
! if (_php3_hashupdate(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
                                  free(mysql);
                                  efree(hashed_details);
                                  RETURN_FALSE;
***************
*** 494,500 ****
  #endif
                                  if (mysql_connect(le->ptr,host,user,passwd)==NULL) {
                                          php3_error(E_WARNING,"MySQL: Link to server lost, unable to reconnect");
! hash_del(plist, hashed_details, hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
--- 494,500 ----
  #endif
                                  if (mysql_connect(le->ptr,host,user,passwd)==NULL) {
                                          php3_error(E_WARNING,"MySQL: Link to server lost, unable to reconnect");
! _php3_hashdel(plist, hashed_details, hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
***************
*** 514,520 ****
                   * if it doesn't, open a new mysql 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;
  
--- 514,520 ----
                   * if it doesn't, open a new mysql 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;
  
***************
*** 529,535 ****
                                  efree(hashed_details);
                                  return;
                          } else {
! hash_del(list,hashed_details,hashed_details_length+1);
                          }
                  }
                  if (MySQL_GLOBAL(php3_mysql_module).max_links!=-1 && MySQL_GLOBAL(php3_mysql_module).num_links>=MySQL_GLOBAL(php3_mysql_module).max_links) {
--- 529,535 ----
                                  efree(hashed_details);
                                  return;
                          } else {
! _php3_hashdel(list,hashed_details,hashed_details_length+1);
                          }
                  }
                  if (MySQL_GLOBAL(php3_mysql_module).max_links!=-1 && MySQL_GLOBAL(php3_mysql_module).num_links>=MySQL_GLOBAL(php3_mysql_module).max_links) {
***************
*** 552,558 ****
                  /* 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;
                  }
--- 552,558 ----
                  /* 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;
                  }
***************
*** 570,578 ****
          if (MySQL_GLOBAL(php3_mysql_module).default_link==-1) { /* no link opened yet, implicitly open one */
                  HashTable tmp;
                  
! hash_init(&tmp,0,NULL,NULL,0);
                  php3_mysql_do_connect(&tmp,return_value,list,plist,0);
! hash_destroy(&tmp);
          }
          return MySQL_GLOBAL(php3_mysql_module).default_link;
  }
--- 570,578 ----
          if (MySQL_GLOBAL(php3_mysql_module).default_link==-1) { /* no link opened yet, implicitly open one */
                  HashTable tmp;
                  
! _php3_hashinit(&tmp,0,NULL,NULL,0);
                  php3_mysql_do_connect(&tmp,return_value,list,plist,0);
! _php3_hashdestroy(&tmp);
          }
          return MySQL_GLOBAL(php3_mysql_module).default_link;
  }
***************
*** 1408,1414 ****
                          } else { */
                                  add_get_index_stringl(return_value, i, mysql_row[i], mysql_row_lengths[i], (void **) &yystype_ptr, 1);
  /* } */
! hash_pointer_update(return_value->value.ht, mysql_field->name, strlen(mysql_field->name)+1, yystype_ptr);
                  } else {
                          /* NULL field, don't set it */
                          /* add_get_index_stringl(return_value, i, empty_string, 0, (void **) &yystype_ptr); */
--- 1408,1414 ----
                          } else { */
                                  add_get_index_stringl(return_value, i, mysql_row[i], mysql_row_lengths[i], (void **) &yystype_ptr, 1);
  /* } */
! _php3_hashpointer_update(return_value->value.ht, mysql_field->name, strlen(mysql_field->name)+1, yystype_ptr);
                  } else {
                          /* NULL field, don't set it */
                          /* add_get_index_stringl(return_value, i, empty_string, 0, (void **) &yystype_ptr); */