[PHP-DEV] CVS update: php3/functions From: kara (php-dev <email protected>)
Date: 06/28/98

Date: Sunday June 28, 1998 @ 5:16
Author: kara

Update of /repository/php3/functions
In directory asf:/tmp/cvs-serv22590/functions

Modified Files:
        oracle.c
Log Message:
Some cosmetic cleanup

Index: php3/functions/oracle.c
diff -c php3/functions/oracle.c:1.72 php3/functions/oracle.c:1.73
*** php3/functions/oracle.c:1.72 Wed Jun 24 02:10:44 1998
--- php3/functions/oracle.c Sun Jun 28 05:16:03 1998
***************
*** 154,160 ****
  php3_module_entry *get_module() { return &oracle_module_entry; };
  #if (WIN32|WINNT) && defined(THREAD_SAFE)
  
! /* NOTE: You should have an odbc.def file where you export DllMain */
  BOOL WINAPI DllMain(HANDLE hModule, DWORD ul_reason_for_call,
                                         LPVOID lpReserved)
  {
--- 154,160 ----
  php3_module_entry *get_module() { return &oracle_module_entry; };
  #if (WIN32|WINNT) && defined(THREAD_SAFE)
  
! /* NOTE: You should have an oracle.def file where you export DllMain */
  BOOL WINAPI DllMain(HANDLE hModule, DWORD ul_reason_for_call,
                                         LPVOID lpReserved)
  {
***************
*** 240,245 ****
--- 240,247 ----
                  }
                  if (cur->params){
                          _php3_hash_destroy(cur->params);
+ efree(cur->params);
+ cur->params = NULL;
                  }
                  if (cur->columns){
                          for(i = 0; i < cur->ncols; i++){
***************
*** 835,846 ****
          RETURN_TRUE;
  }
  
! /*
   */
  void php3_Ora_Exec(INTERNAL_FUNCTION_PARAMETERS)
  { /* cursor_index */
          pval *arg;
          oraCursor *cursor = NULL;
          if (getParameters(ht, 1, &arg) == FAILURE)
                  WRONG_PARAM_COUNT;
  
--- 837,850 ----
          RETURN_TRUE;
  }
  
! /*
! XXX Make return values compatible with old module ?
   */
  void php3_Ora_Exec(INTERNAL_FUNCTION_PARAMETERS)
  { /* cursor_index */
          pval *arg;
          oraCursor *cursor = NULL;
+
          if (getParameters(ht, 1, &arg) == FAILURE)
                  WRONG_PARAM_COUNT;
  
***************
*** 1414,1426 ****
          php3_error(E_WARNING,"Bad Oracle connection number (%d)", ind);
          return NULL;
  }
! /*
! static void
! ora_del_conn(HashTable *list, int ind)
! {
! php3_list_delete(ind);
! }
! */
  int ora_add_cursor(HashTable *list, oraCursor *cursor)
  {
          ORACLE_TLS_VARS;
--- 1418,1424 ----
          php3_error(E_WARNING,"Bad Oracle connection number (%d)", ind);
          return NULL;
  }
!
  int ora_add_cursor(HashTable *list, oraCursor *cursor)
  {
          ORACLE_TLS_VARS;
***************
*** 1589,1594 ****
--- 1587,1593 ----
                  }
                  if(_php3_hash_get_current_data(cursor->params, (void **)&param) == FAILURE){
              php3_error(E_WARNING, "Can't get parameter data");
+ /* XXX efree paramname */
              return 0;
          }
  
***************
*** 1597,1609 ****
--- 1596,1611 ----
                          if(param->type != 1 && param->alen > 0){
                                  SET_VAR_STRINGL(paramname, param->progv, param->alen);
                          }
+ /* XXX efree paramname */
                          continue;
                  }else if(param->type == 2){
+ /* XXX efree paramname */
                          continue;
                  }
  
                  if(_php3_hash_find(&GLOBAL(symbol_table), paramname, strlen(paramname) + 1, (void **)&pdata) == FAILURE){
                          php3_error(E_WARNING, "Can't find variable for parameter");
+ /* XXX efree paramname */
                          return 0;
                  }
                  convert_to_string(pdata);
***************
*** 1615,1669 ****
                  strncpy(param->progv, pdata->value.str.val, len);
  
                  param->progv[len] = '\0';
          }
          return 1;
          
  }
  
- /* Scan statement for parameters and setup hash if any found. Currently only named
- parameters are supported (e.g. :foo). Returns number of distinct parameters.
- */
- #if 0
- int ora_numparams(char *sql, oraCursor *curs)
- {
- while(*sql) {
- if (*sql == '\'')
- in_literal = ~in_literal;
- if ((*sql != ':' && *sql != '?') || in_literal) {
- sql++;
- continue;
- }
- start = sql; /* save name inc colon */
- sql++;
- if (*start == '?') { /* X/Open standard */
- return -1;
- } else if (isDIGIT(*sql)){ /* ':1' */
- return -1;
- } else if (isALNUM(*src)) { /* ':foo' */
- while(isALNUM(*src)) /* includes '_' */
- sql++;
- } else { /* perhaps ':=' PL/SQL construct */
- continue;
- }
- namelen = sql - start;
- if (curs->params == NULL){
- if (!(curs->params = (HashTable *)emalloc(sizeof(HashTable)))){
- php3_error(E_WARNING, "Out of memory");
- return -1;
- }
- if (_php3_hash_init(cursor->params, 19, NULL,
- (void (*)(void *))yystype_ora_param_destructor, 0) ==
- FAILURE){
- php3_error(E_WARNING, "Unable to initialize parameter list");
- efree(curs->params);
- curs->params = NULL;
- return -1;
- }
- }
- _php3_hash_add(curs->params, start, namelen, ptr, size, (void **)&pDest)
-
- }
- #endif
  #endif /* HAVE_ORACLE */
  
  /*
--- 1617,1628 ----
                  strncpy(param->progv, pdata->value.str.val, len);
  
                  param->progv[len] = '\0';
+ /* XXX efree paramname */
          }
          return 1;
          
  }
  
  #endif /* HAVE_ORACLE */
  
  /*