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

Date: Saturday April 24, 1999 @ 13:36
Author: thies

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

Modified Files:
        oci8.c
Log Message:
tiny updates.tiny updates...

Index: php3/functions/oci8.c
diff -u php3/functions/oci8.c:1.85 php3/functions/oci8.c:1.86
--- php3/functions/oci8.c:1.85 Thu Apr 22 09:19:50 1999
+++ php3/functions/oci8.c Sat Apr 24 13:36:30 1999
@@ -33,7 +33,7 @@
 
 #define OCI8_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */
 
-/* $Id: oci8.c,v 1.85 1999/04/22 13:19:50 ssb Exp $ */
+/* $Id: oci8.c,v 1.86 1999/04/24 17:36:30 thies Exp $ */
 
 /* TODO list:
  *
@@ -71,7 +71,13 @@
 #endif
 
 #include "php.h"
-#include "internal_functions.h"
+
+#if PHP_API_VERSION < 19990421
+ #include "internal_functions.h"
+ #include "php3_list.h"
+ #include "head.h"
+#endif
+
 #include "php3_oci8.h"
 
 #if HAVE_OCI8
@@ -92,12 +98,10 @@
 
 #define SAFE_STRING(s) ((s)?(s):"")
 
-#include "php3_list.h"
 #if !(WIN32|WINNT)
 # include "build-defs.h"
 #endif
 #include "snprintf.h"
-#include "head.h"
 
 /* }}} */
 /* {{{ thread safety stuff */
@@ -156,8 +160,8 @@
 
 int php3_minit_oci8(INIT_FUNC_ARGS);
 int php3_rinit_oci8(INIT_FUNC_ARGS);
-int php3_mshutdown_oci8(void);
-int php3_rshutdown_oci8(void);
+int php3_mshutdown_oci8(SHUTDOWN_FUNC_ARGS);
+int php3_rshutdown_oci8(SHUTDOWN_FUNC_ARGS);
 void php3_info_oci8(void);
 
 static ub4 oci8_error(OCIError *err_p, char *what, sword status);
@@ -173,7 +177,7 @@
 static oci8_statement *oci8_get_stmt(int, const char *, HashTable *);
 static oci8_out_column *oci8_get_col(oci8_statement *, int, pval *, char *);
 
-static int oci8_make_pval(pval *,int,oci8_out_column *, char *,HashTable *, int mode);
+static int oci8_make_pval(pval *,oci8_statement *,oci8_out_column *, char *,HashTable *, int mode);
 static int oci8_parse(oci8_connection *, text *, ub4, HashTable *);
 static int oci8_execute(oci8_statement *, char *,ub4 mode);
 static int oci8_fetch(oci8_statement *, ub4, char *);
@@ -460,7 +464,7 @@
         return 0;
 }
 
-int php3_mshutdown_oci8()
+int php3_mshutdown_oci8(SHUTDOWN_FUNC_ARGS)
 {
     oci8_debug("php3_mshutdown_oci8");
 
@@ -517,7 +521,7 @@
         return 0;
 }
 
-int php3_rshutdown_oci8()
+int php3_rshutdown_oci8(SHUTDOWN_FUNC_ARGS)
 {
         OCI8_TLS_VARS;
 
@@ -860,10 +864,9 @@
 /* {{{ oci8_make_pval() */
 
 static int
-oci8_make_pval(pval *value,int stmt_ind,oci8_out_column *column, char *func,HashTable *list, int mode)
+oci8_make_pval(pval *value,oci8_statement *statement,oci8_out_column *column, char *func,HashTable *list, int mode)
 {
         size_t size;
- oci8_statement *statement;
         oci8_descriptor *descr;
         ub4 loblen;
         char *buffer;
@@ -875,8 +878,6 @@
 
         memset(value,0,sizeof(pval));
 
- statement = oci8_get_stmt(stmt_ind, "oci8_make_pval", list);
-
         if (column->indicator == -1) { /* column is NULL */
                 var_reset(value); /* XXX we NEED to make sure that there's no data attached to this yet!!! */
                 return 0;
@@ -3062,7 +3063,7 @@
 
 void php3_oci8_fetchinto(INTERNAL_FUNCTION_PARAMETERS)
 {
- pval *stmt, *array, element, *fmode;
+ pval *stmt, *array, *element, *fmode;
         oci8_statement *statement;
         oci8_out_column *column;
         ub4 nrows = 1;
@@ -3091,6 +3092,7 @@
            if we don't want NULL columns back, we need to recreate the array
            as it could have a different number of enties for each fetched row
         */
+
         if (! (mode & OCI_RETURN_NULLS)) {
                 if (array->type == IS_ARRAY) {
                         /* XXX is that right?? */
@@ -3107,6 +3109,8 @@
                 }
         }
 
+ element = emalloc(sizeof(pval));
+
         for (i = 0; i < statement->ncolumns; i++) {
                 column = oci8_get_col(statement, i + 1, 0, "OCIFetchInto");
                 if (column == NULL) { /* should not happen... */
@@ -3118,16 +3122,19 @@
                 }
 
                 if ((mode & OCI_NUM) || (! (mode & OCI_ASSOC))) { /* OCI_NUM is default */
- oci8_make_pval(&element,stmt->value.lval,column, "OCIFetchInto",list,mode);
- _php3_hash_index_update(array->value.ht, i, (void *)&element, sizeof(pval), NULL);
+ oci8_make_pval(element,statement,column, "OCIFetchInto",list,mode);
+ _php3_hash_index_update(array->value.ht, i, (void *)element, sizeof(pval), NULL);
                 }
 
                 if (mode & OCI_ASSOC) {
- oci8_make_pval(&element,stmt->value.lval,column, "OCIFetchInto",list,mode);
- _php3_hash_update(array->value.ht, column->name, column->name_len+1, (void *)&element, sizeof(pval), NULL);
+ oci8_make_pval(element,statement,column, "OCIFetchInto",list,mode);
+
+ _php3_hash_update(array->value.ht, column->name, column->name_len+1, (void *)element, sizeof(pval), NULL);
                 }
         }
 
+ efree(element);
+
         RETURN_LONG(statement->ncolumns);
 }
 
@@ -3186,7 +3193,7 @@
 
         while (oci8_fetch(statement, nrows, "OCIFetchStatement")) {
                 for (i = 0; i < statement->ncolumns; i++) {
- oci8_make_pval(&element,stmt->value.lval,columns[ i ], "OCIFetchStatement",list,OCI_RETURN_LOBS);
+ oci8_make_pval(&element,statement,columns[ i ], "OCIFetchStatement",list,OCI_RETURN_LOBS);
                         _php3_hash_index_update(outarrs[ i ]->value.ht, rows, (void *)&element, sizeof(pval), NULL);
                 }
                 rows++;
@@ -3419,7 +3426,7 @@
                 RETURN_FALSE;
         }
 
- oci8_make_pval(return_value,stmt->value.lval,outcol, "OCIResult",list,0);
+ oci8_make_pval(return_value,statement,outcol, "OCIResult",list,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>