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

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

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

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

Index: php31/ext/sybase/sybase-ct.c
diff -c php31/ext/sybase/sybase-ct.c:1.1.1.1 php31/ext/sybase/sybase-ct.c:1.2
*** php31/ext/sybase/sybase-ct.c:1.1.1.1 Tue May 26 22:26:56 1998
--- php31/ext/sybase/sybase-ct.c Fri Jun 26 12:53:20 1998
***************
*** 27,33 ****
     +----------------------------------------------------------------------+
   */
   
! /* $Id: sybase-ct.c,v 1.1.1.1 1998/05/27 02:26:56 rasmus Exp $ */
  
  
  #ifndef MSVC5
--- 27,33 ----
     +----------------------------------------------------------------------+
   */
   
! /* $Id: sybase-ct.c,v 1.2 1998/06/26 16:53:20 zeev Exp $ */
  
  
  #ifndef MSVC5
***************
*** 139,145 ****
  static void _close_sybct_link(sybct_link *sybct_ptr)
  {
          sybct_ptr->valid = 0;
! hash_apply(resource_list,(int (*)(void *))_clean_invalid_results);
          ct_close(sybct_ptr->connection, CS_UNUSED);
          ct_con_drop(sybct_ptr->connection);
          efree(sybct_ptr);
--- 139,145 ----
  static void _close_sybct_link(sybct_link *sybct_ptr)
  {
          sybct_ptr->valid = 0;
! _php3_hashapply(resource_list,(int (*)(void *))_clean_invalid_results);
          ct_close(sybct_ptr->connection, CS_UNUSED);
          ct_con_drop(sybct_ptr->connection);
          efree(sybct_ptr);
***************
*** 336,342 ****
                  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 (php3_sybct_module.max_links!=-1 && php3_sybct_module.num_links>=php3_sybct_module.max_links) {
--- 336,342 ----
                  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 (php3_sybct_module.max_links!=-1 && php3_sybct_module.num_links>=php3_sybct_module.max_links) {
***************
*** 370,376 ****
                          memcpy(sybct_ptr,&sybct,sizeof(sybct_link));
                          new_le.type = php3_sybct_module.le_plink;
                          new_le.ptr = sybct_ptr;
! if (hash_update(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry),NULL)==FAILURE) {
                                  free(sybct_ptr);
                                  efree(hashed_details);
                                  ct_close(sybct.connection, CS_UNUSED);
--- 370,376 ----
                          memcpy(sybct_ptr,&sybct,sizeof(sybct_link));
                          new_le.type = php3_sybct_module.le_plink;
                          new_le.ptr = sybct_ptr;
! if (_php3_hashupdate(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry),NULL)==FAILURE) {
                                  free(sybct_ptr);
                                  efree(hashed_details);
                                  ct_close(sybct.connection, CS_UNUSED);
***************
*** 389,400 ****
                          /* No clue how to do it with CT-lib...
                          if (DBDEAD(sybct_ptr->link)==TRUE) {
                                  if (dbopen(sybct_ptr->login,host)==FAIL) {
! hash_del(plist, hashed_details, hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
                                  if (dbsetopt(sybct_ptr->link,DBBUFFER,"2",-1)==FAIL) {
! hash_del(plist, hashed_details, hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
--- 389,400 ----
                          /* No clue how to do it with CT-lib...
                          if (DBDEAD(sybct_ptr->link)==TRUE) {
                                  if (dbopen(sybct_ptr->login,host)==FAIL) {
! _php3_hashdel(plist, hashed_details, hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
                                  if (dbsetopt(sybct_ptr->link,DBBUFFER,"2",-1)==FAIL) {
! _php3_hashdel(plist, hashed_details, hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
***************
*** 411,417 ****
                   * if it doesn't, open a new sybct 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;
  
--- 411,417 ----
                   * if it doesn't, open a new sybct 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;
  
***************
*** 426,432 ****
                                  efree(hashed_details);
                                  return;
                          } else {
! hash_del(list,hashed_details,hashed_details_length+1);
                          }
                  }
                  if (php3_sybct_module.max_links!=-1 && php3_sybct_module.num_links>=php3_sybct_module.max_links) {
--- 426,432 ----
                                  efree(hashed_details);
                                  return;
                          } else {
! _php3_hashdel(list,hashed_details,hashed_details_length+1);
                          }
                  }
                  if (php3_sybct_module.max_links!=-1 && php3_sybct_module.num_links>=php3_sybct_module.max_links) {
***************
*** 459,465 ****
                  /* 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;
                  }
--- 459,465 ----
                  /* 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;
                  }
***************
*** 475,483 ****
          if (php3_sybct_module.default_link==-1) { /* no link opened yet, implicitly open one */
                  HashTable dummy;
  
! hash_init(&dummy,0,NULL,NULL,0);
                  php3_sybct_do_connect(&dummy,return_value,list,plist,0);
! hash_destroy(&dummy);
          }
          return php3_sybct_module.default_link;
  }
--- 475,483 ----
          if (php3_sybct_module.default_link==-1) { /* no link opened yet, implicitly open one */
                  HashTable dummy;
  
! _php3_hashinit(&dummy,0,NULL,NULL,0);
                  php3_sybct_do_connect(&dummy,return_value,list,plist,0);
! _php3_hashdestroy(&dummy);
          }
          return php3_sybct_module.default_link;
  }
***************
*** 977,983 ****
          for (i=0; i<result->num_fields; i++) {
                  field_content = result->data[result->cur_row][i];
                  yystype_copy_constructor(&field_content);
! hash_index_update(return_value->value.ht, i, (void *) &field_content, sizeof(pval),NULL);
          }
          result->cur_row++;
  }
--- 977,983 ----
          for (i=0; i<result->num_fields; i++) {
                  field_content = result->data[result->cur_row][i];
                  yystype_copy_constructor(&field_content);
! _php3_hashindex_update(return_value->value.ht, i, (void *) &field_content, sizeof(pval),NULL);
          }
          result->cur_row++;
  }
***************
*** 1017,1024 ****
                  if (php3_ini.magic_quotes_runtime && tmp.type == IS_STRING) {
                          tmp.value.str.val = _php3_addslashes(tmp.value.str.val,tmp.value.str.len,&tmp.value.str.len,1);
                  }
! hash_index_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval), (void **) &yystype_ptr);
! hash_pointer_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, yystype_ptr);
          }
          result->cur_row++;
  }
--- 1017,1024 ----
                  if (php3_ini.magic_quotes_runtime && tmp.type == IS_STRING) {
                          tmp.value.str.val = _php3_addslashes(tmp.value.str.val,tmp.value.str.len,&tmp.value.str.len,1);
                  }
! _php3_hashindex_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval), (void **) &yystype_ptr);
! _php3_hashpointer_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, yystype_ptr);
          }
          result->cur_row++;
  }
Index: php31/ext/sybase/sybase.c
diff -c php31/ext/sybase/sybase.c:1.1.1.1 php31/ext/sybase/sybase.c:1.2
*** php31/ext/sybase/sybase.c:1.1.1.1 Tue May 26 22:26:57 1998
--- php31/ext/sybase/sybase.c Fri Jun 26 12:53:20 1998
***************
*** 31,37 ****
     +----------------------------------------------------------------------+
   */
   
! /* $Id: sybase.c,v 1.1.1.1 1998/05/27 02:26:57 rasmus Exp $ */
  
  
  #ifndef MSVC5
--- 31,37 ----
     +----------------------------------------------------------------------+
   */
   
! /* $Id: sybase.c,v 1.2 1998/06/26 16:53:20 zeev Exp $ */
  
  
  #ifndef MSVC5
***************
*** 176,182 ****
  static void _close_sybase_link(sybase_link *sybase_ptr)
  {
          sybase_ptr->valid = 0;
! hash_apply(resource_list,(int (*)(void *))_clean_invalid_results);
          dbclose(sybase_ptr->link);
          dbloginfree(sybase_ptr->login);
          efree(sybase_ptr);
--- 176,182 ----
  static void _close_sybase_link(sybase_link *sybase_ptr)
  {
          sybase_ptr->valid = 0;
! _php3_hashapply(resource_list,(int (*)(void *))_clean_invalid_results);
          dbclose(sybase_ptr->link);
          dbloginfree(sybase_ptr->login);
          efree(sybase_ptr);
***************
*** 357,363 ****
                  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 (php3_sybase_module.max_links!=-1 && php3_sybase_module.num_links>=php3_sybase_module.max_links) {
--- 357,363 ----
                  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 (php3_sybase_module.max_links!=-1 && php3_sybase_module.num_links>=php3_sybase_module.max_links) {
***************
*** 392,398 ****
                          memcpy(sybase_ptr,&sybase,sizeof(sybase_link));
                          new_le.type = php3_sybase_module.le_plink;
                          new_le.ptr = sybase_ptr;
! if (hash_update(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry),NULL)==FAILURE) {
                                  free(sybase_ptr);
                                  efree(hashed_details);
                                  dbloginfree(sybase.login);
--- 392,398 ----
                          memcpy(sybase_ptr,&sybase,sizeof(sybase_link));
                          new_le.type = php3_sybase_module.le_plink;
                          new_le.ptr = sybase_ptr;
! if (_php3_hashupdate(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry),NULL)==FAILURE) {
                                  free(sybase_ptr);
                                  efree(hashed_details);
                                  dbloginfree(sybase.login);
***************
*** 420,426 ****
                                          log_error("PHP/Sybase: Unable to reconnect!",php3_rqst->server);
  #endif
                                          /*php3_error(E_WARNING,"Sybase: Link to server lost, unable to reconnect");*/
! hash_del(plist, hashed_details, hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
--- 420,426 ----
                                          log_error("PHP/Sybase: Unable to reconnect!",php3_rqst->server);
  #endif
                                          /*php3_error(E_WARNING,"Sybase: Link to server lost, unable to reconnect");*/
! _php3_hashdel(plist, hashed_details, hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
***************
*** 431,437 ****
  #if BROKEN_SYBASE_PCONNECTS
                                          log_error("PHP/Sybase: Unable to set required options",php3_rqst->server);
  #endif
! hash_del(plist, hashed_details, hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
--- 431,437 ----
  #if BROKEN_SYBASE_PCONNECTS
                                          log_error("PHP/Sybase: Unable to set required options",php3_rqst->server);
  #endif
! _php3_hashdel(plist, hashed_details, hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
***************
*** 447,453 ****
                   * if it doesn't, open a new sybase 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;
  
--- 447,453 ----
                   * if it doesn't, open a new sybase 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;
  
***************
*** 462,468 ****
                                  efree(hashed_details);
                                  return;
                          } else {
! hash_del(list,hashed_details,hashed_details_length+1);
                          }
                  }
                  if (php3_sybase_module.max_links!=-1 && php3_sybase_module.num_links>=php3_sybase_module.max_links) {
--- 462,468 ----
                                  efree(hashed_details);
                                  return;
                          } else {
! _php3_hashdel(list,hashed_details,hashed_details_length+1);
                          }
                  }
                  if (php3_sybase_module.max_links!=-1 && php3_sybase_module.num_links>=php3_sybase_module.max_links) {
***************
*** 493,499 ****
                  /* 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;
                  }
--- 493,499 ----
                  /* 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;
                  }
***************
*** 509,517 ****
          if (php3_sybase_module.default_link==-1) { /* no link opened yet, implicitly open one */
                  HashTable dummy;
  
! hash_init(&dummy,0,NULL,NULL,0);
                  php3_sybase_do_connect(&dummy,return_value,list,plist,0);
! hash_destroy(&dummy);
          }
          return php3_sybase_module.default_link;
  }
--- 509,517 ----
          if (php3_sybase_module.default_link==-1) { /* no link opened yet, implicitly open one */
                  HashTable dummy;
  
! _php3_hashinit(&dummy,0,NULL,NULL,0);
                  php3_sybase_do_connect(&dummy,return_value,list,plist,0);
! _php3_hashdestroy(&dummy);
          }
          return php3_sybase_module.default_link;
  }
***************
*** 917,923 ****
          for (i=0; i<result->num_fields; i++) {
                  field_content = result->data[result->cur_row][i];
                  yystype_copy_constructor(&field_content);
! hash_index_update(return_value->value.ht, i, (void *) &field_content, sizeof(pval),NULL);
          }
          result->cur_row++;
  }
--- 917,923 ----
          for (i=0; i<result->num_fields; i++) {
                  field_content = result->data[result->cur_row][i];
                  yystype_copy_constructor(&field_content);
! _php3_hashindex_update(return_value->value.ht, i, (void *) &field_content, sizeof(pval),NULL);
          }
          result->cur_row++;
  }
***************
*** 957,964 ****
                  if (php3_ini.magic_quotes_runtime && tmp.type == IS_STRING) {
                          tmp.value.str.val = _php3_addslashes(tmp.value.str.val,tmp.value.str.len,&tmp.value.str.len,1);
                  }
! hash_index_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval), (void **) &yystype_ptr);
! hash_pointer_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, yystype_ptr);
          }
          result->cur_row++;
  }
--- 957,964 ----
                  if (php3_ini.magic_quotes_runtime && tmp.type == IS_STRING) {
                          tmp.value.str.val = _php3_addslashes(tmp.value.str.val,tmp.value.str.len,&tmp.value.str.len,1);
                  }
! _php3_hashindex_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval), (void **) &yystype_ptr);
! _php3_hashpointer_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, yystype_ptr);
          }
          result->cur_row++;
  }