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

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

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

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

Index: php31/ext/postgres/pgsql.c
diff -c php31/ext/postgres/pgsql.c:1.1.1.1 php31/ext/postgres/pgsql.c:1.2
*** php31/ext/postgres/pgsql.c:1.1.1.1 Tue May 26 22:26:56 1998
--- php31/ext/postgres/pgsql.c Fri Jun 26 12:53:01 1998
***************
*** 28,34 ****
     +----------------------------------------------------------------------+
   */
   
! /* $Id: pgsql.c,v 1.1.1.1 1998/05/27 02:26:56 rasmus Exp $ */
  
  #include <stdlib.h>
  
--- 28,34 ----
     +----------------------------------------------------------------------+
   */
   
! /* $Id: pgsql.c,v 1.2 1998/06/26 16:53:01 zeev Exp $ */
  
  #include <stdlib.h>
  
***************
*** 227,233 ****
                  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_pgsql_module.max_links!=-1 && php3_pgsql_module.num_links>=php3_pgsql_module.max_links) {
--- 227,233 ----
                  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_pgsql_module.max_links!=-1 && php3_pgsql_module.num_links>=php3_pgsql_module.max_links) {
***************
*** 256,262 ****
                          /* hash it up */
                          new_le.type = php3_pgsql_module.le_plink;
                          new_le.ptr = pgsql;
! if (hash_update(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
                                  efree(hashed_details);
                                  RETURN_FALSE;
                          }
--- 256,262 ----
                          /* hash it up */
                          new_le.type = php3_pgsql_module.le_plink;
                          new_le.ptr = pgsql;
! if (_php3_hashupdate(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
                                  efree(hashed_details);
                                  RETURN_FALSE;
                          }
***************
*** 275,281 ****
                                  }
                                  if (le->ptr==NULL || PQstatus(le->ptr)==CONNECTION_BAD) {
                                          php3_error(E_WARNING,"PostgresSQL link lost, unable to reconnect");
! hash_del(plist,hashed_details,hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
--- 275,281 ----
                                  }
                                  if (le->ptr==NULL || PQstatus(le->ptr)==CONNECTION_BAD) {
                                          php3_error(E_WARNING,"PostgresSQL link lost, unable to reconnect");
! _php3_hashdel(plist,hashed_details,hashed_details_length+1);
                                          efree(hashed_details);
                                          RETURN_FALSE;
                                  }
***************
*** 292,298 ****
                   * if it doesn't, open a new pgsql 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;
  
--- 292,298 ----
                   * if it doesn't, open a new pgsql 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;
  
***************
*** 307,313 ****
                                  efree(hashed_details);
                                  return;
                          } else {
! hash_del(list,hashed_details,hashed_details_length+1);
                          }
                  }
                  if (php3_pgsql_module.max_links!=-1 && php3_pgsql_module.num_links>=php3_pgsql_module.max_links) {
--- 307,313 ----
                                  efree(hashed_details);
                                  return;
                          } else {
! _php3_hashdel(list,hashed_details,hashed_details_length+1);
                          }
                  }
                  if (php3_pgsql_module.max_links!=-1 && php3_pgsql_module.num_links>=php3_pgsql_module.max_links) {
***************
*** 333,339 ****
                  /* 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;
                  }
--- 333,339 ----
                  /* 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;
                  }
***************
*** 349,357 ****
          if (php3_pgsql_module.default_link==-1) { /* no link opened yet, implicitly open one */
                  HashTable tmp;
                  
! hash_init(&tmp,0,NULL,NULL,0);
                  php3_pgsql_do_connect(&tmp,return_value,list,plist,0);
! hash_destroy(&tmp);
          }
          return php3_pgsql_module.default_link;
  }
--- 349,357 ----
          if (php3_pgsql_module.default_link==-1) { /* no link opened yet, implicitly open one */
                  HashTable tmp;
                  
! _php3_hashinit(&tmp,0,NULL,NULL,0);
                  php3_pgsql_do_connect(&tmp,return_value,list,plist,0);
! _php3_hashdestroy(&tmp);
          }
          return php3_pgsql_module.default_link;
  }
***************
*** 628,634 ****
          snprintf(hashed_oid_key,31,"pgsql_oid_%d",(int) oid);
          hashed_oid_key[31]=0;
  
! if (hash_find(list,hashed_oid_key,strlen(hashed_oid_key)+1,(void **) &field_type)==SUCCESS) {
                  ret = estrdup((char *)field_type->ptr);
          } else { /* hash all oid's */
                  int i,num_rows;
--- 628,634 ----
          snprintf(hashed_oid_key,31,"pgsql_oid_%d",(int) oid);
          hashed_oid_key[31]=0;
  
! if (_php3_hashfind(list,hashed_oid_key,strlen(hashed_oid_key)+1,(void **) &field_type)==SUCCESS) {
                  ret = estrdup((char *)field_type->ptr);
          } else { /* hash all oid's */
                  int i,num_rows;
***************
*** 653,659 ****
                          }
                          new_oid_entry.type = php3_pgsql_module.le_string;
                          new_oid_entry.ptr = estrdup(tmp_name);
! hash_update(list,hashed_oid_key,strlen(hashed_oid_key)+1,(void *) &new_oid_entry, sizeof(list_entry), NULL);
                          if (!ret && atoi(tmp_oid)==oid) {
                                  ret = estrdup(tmp_name);
                          }
--- 653,659 ----
                          }
                          new_oid_entry.type = php3_pgsql_module.le_string;
                          new_oid_entry.ptr = estrdup(tmp_name);
! _php3_hashupdate(list,hashed_oid_key,strlen(hashed_oid_key)+1,(void *) &new_oid_entry, sizeof(list_entry), NULL);
                          if (!ret && atoi(tmp_oid)==oid) {
                                  ret = estrdup(tmp_name);
                          }