[PHP-DEV] CVS update: php3/functions From: thies (php-dev <email protected>)
Date: 04/30/99

Date: Friday April 30, 1999 @ 14:59
Author: thies

Update of /repository/php3/functions
In directory php:/tmp/cvs-serv30821/functions

Modified Files:
        oracle.c
Log Message:
small compiler adjustments

Index: php3/functions/oracle.c
diff -u php3/functions/oracle.c:1.102 php3/functions/oracle.c:1.103
--- php3/functions/oracle.c:1.102 Fri Apr 30 05:49:23 1999
+++ php3/functions/oracle.c Fri Apr 30 14:59:55 1999
@@ -27,11 +27,9 @@
    | Mitch Golden <mgolden <email protected>> |
    | Rasmus Lerdorf <rasmus <email protected>> |
    | Andreas Karajannis <Andreas.Karajannis <email protected>> |
+ | Thies C. Arntzen <thies <email protected>> |
    +----------------------------------------------------------------------+
  */
-
-/* $Id: oracle.c,v 1.102 1999/04/30 09:49:23 thies Exp $ */
-
 #if defined(COMPILE_DL)
 # if PHP_31
 # include "../phpdl.h"
@@ -43,16 +41,25 @@
 # endif
 #endif
 #include "php.h"
-#include "internal_functions.h"
-#include "oracle.h"
 
+#if PHP_API_VERSION < 19990421
+ #include "internal_functions.h"
+ #include "php3_list.h"
+ #include "head.h"
+#else
+ #include "zend_globals.h"
+#endif
+
 #if HAVE_ORACLE
-#include "php3_list.h"
+
+#include "oracle.h"
 #ifdef WIN32
 # include "variables.h"
 #else
 # include "build-defs.h"
 #endif
+
+
 #include "snprintf.h"
 
 #ifndef min
@@ -1130,7 +1137,7 @@
    Fetch a row into the specified result array */
 void php3_Ora_FetchInto(INTERNAL_FUNCTION_PARAMETERS)
 {
- pval *arg1, *arr, *flg, tmp;
+ pval *arg1, *arr, *flg, *tmp;
         oraCursor *cursor;
         ub4 ret_len;
         int i;
@@ -1189,16 +1196,18 @@
         }
         cursor->fetched++;
 
+#if PHP_API_VERSION < 19990421
+ tmp = emalloc(sizeof(pval));
+#endif
+
         for (i = 0; i < cursor->ncols; i++) {
- tmp.type = IS_STRING;
- tmp.value.str.len = 0;
        
                 if (cursor->columns[i].col_retcode == 1405) {
                         if (!(flags&ORA_FETCHINTO_NULLS)){
                                 continue; /* don't add anything for NULL columns, unless the calles wants it */
                         } else {
- tmp.value.str.val = empty_string;
- tmp.value.str.len = 0;
+ tmp->value.str.val = empty_string;
+ tmp->value.str.len = 0;
                         }
                 } else if (cursor->columns[i].col_retcode != 0 &&
                                    cursor->columns[i].col_retcode != 1406) {
@@ -1210,31 +1219,53 @@
                         /* return what we did get, in that case */
                         RETURN_FALSE;
                 } else {
+#if PHP_API_VERSION >= 19990421
+ tmp = emalloc(sizeof(pval));
+ tmp->is_ref = 0;
+ tmp->refcount = 1;
+#endif
+
+ tmp->type = IS_STRING;
+ tmp->value.str.len = 0;
+
                         switch(cursor->columns[i].dbtype) {
                                 case SQLT_LNG:
                                 case SQLT_LBI:
                                         /* XXX 64k max for LONG and LONG RAW */
                                         oflng(&cursor->cda, (sword)(i + 1), cursor->columns[i].buf, DB_SIZE, 1,
                                                   &ret_len, 0);
- tmp.value.str.len = ret_len;
+
+ tmp->value.str.len = ret_len;
                                         break;
                                 default:
- tmp.value.str.len = min(cursor->columns[i].col_retlen,
- cursor->columns[i].dsize);
+ tmp->value.str.len = min(cursor->columns[i].col_retlen,
+ cursor->columns[i].dsize);
                                         break;
                         }
- tmp.value.str.val = estrndup(cursor->columns[i].buf,
- tmp.value.str.len);
+ tmp->value.str.val = estrndup(cursor->columns[i].buf,
+ tmp->value.str.len);
                 }
 
                 if (flags&ORA_FETCHINTO_ASSOC){
+#if PHP_API_VERSION >= 19990421
                         _php3_hash_update(arr->value.ht, cursor->columns[i].cbuf, cursor->columns[i].cbufl+1, (void *) &tmp, sizeof(pval), NULL);
+#else
+ _php3_hash_update(arr->value.ht, cursor->columns[i].cbuf, cursor->columns[i].cbufl+1, (void *) tmp, sizeof(pval), NULL);
+#endif
                 } else {
+#if PHP_API_VERSION >= 19990421
                         _php3_hash_index_update(arr->value.ht, i, (void *) &tmp, sizeof(pval), NULL);
+#else
+ _php3_hash_index_update(arr->value.ht, i, (void *) tmp, sizeof(pval), NULL);
+#endif
                 }
 
         }
 
+#if PHP_API_VERSION < 19990421
+ efree(tmp);
+#endif
+
         RETURN_LONG(cursor->ncols);
 }
 /* }}} */
@@ -1775,7 +1806,12 @@
                         return 0;
                 }
 #else
+
+#if PHP_API_VERSION < 19990421
                 if(_php3_hash_find(&GLOBAL(symbol_table), paramname, strlen(paramname) + 1, (void **)&pdata) == FAILURE){
+#else
+ if(_php3_hash_find(&EG(symbol_table), paramname, strlen(paramname) + 1, (void **)&pdata) == FAILURE){
+#endif
                         php3_error(E_WARNING, "Can't find variable for parameter");
                         efree(paramname);
                         return 0;

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>