CVS update: php3/functions

From: Date: Tue, 06 Apr 1999 12:05:01 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4954@lists.php.net to get a copy of this message
Date: Tuesday April 6, 1999 @ 8:05 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv10756 Modified Files: oci8.c Log Message: fixed some NULL handling Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.71 php3/functions/oci8.c:1.72 *** php3/functions/oci8.c:1.71 Mon Apr 5 14:24:44 1999 --- php3/functions/oci8.c Tue Apr 6 08:05:00 1999 *************** *** 33,39 **** #define OCI8_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */ ! /* $Id: oci8.c,v 1.71 1999/04/05 18:24:44 thies Exp $ */ /* TODO list: * --- 33,39 ---- #define OCI8_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */ ! /* $Id: oci8.c,v 1.72 1999/04/06 12:05:00 thies Exp $ */ /* TODO list: * *************** *** 396,401 **** --- 396,403 ---- OCI8_GLOBAL(php3_oci8_module).debug_mode = 0; /* start "fresh" */ + oci8_debug("php3_rinit_oci8"); + return SUCCESS; } *************** *** 818,840 **** ub4 loblen; char *buffer; ! /* ! oci8_debug("oci8_make_pval: %s,rlen = %d,storage_size4 = %d,size2 = %d,indicator %d, retcode = %d", ! column->name,column->rlen,column->storage_size4,column->size2,column->indicator,column->retcode); ! */ memset(value,0,sizeof(pval)); statement = oci8_get_stmt(stmt_ind, "oci8_make_pval", list); if (column->is_descr) { if ((column->type != SQLT_RDD) && (mode & OCI_RETURN_LOBS)) { /* OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */ - if (column->indicator == -1) { - var_reset(value); - return 0; - } if (_php3_hash_index_find(statement->conn->descriptors,(int) column->data, (void **)&descr) == FAILURE) { php3_error(E_WARNING, "unable to find my descriptor %d",column->data); return -1; --- 820,843 ---- ub4 loblen; char *buffer; ! /* ! oci8_debug("oci8_make_pval: %16s,rlen = %4d,storage_size4 = %4d,size2 = %4d,indicator %4d, retcode = %4d", ! column->name,column->rlen,column->storage_size4,column->size2,column->indicator,column->retcode); ! */ 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; + } + if (column->is_descr) { if ((column->type != SQLT_RDD) && (mode & OCI_RETURN_LOBS)) { /* OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */ if (_php3_hash_index_find(statement->conn->descriptors,(int) column->data, (void **)&descr) == FAILURE) { php3_error(E_WARNING, "unable to find my descriptor %d",column->data); return -1; *************** *** 1484,1492 **** if (val->type == IS_OBJECT) { } else if (val->type == IS_STRING) { ! if (val->value.str.val && (val->value.str.val!=undefined_variable_string) && (val->value.str.val!=empty_string)) { ! efree(val->value.str.val); /* free the "old" value */ ! } phpbind->value->value.str.len = phpbind->maxsize; phpbind->value->value.str.val = emalloc(phpbind->maxsize); --- 1487,1494 ---- if (val->type == IS_OBJECT) { } else if (val->type == IS_STRING) { ! STR_FREE(val->value.str.val); ! phpbind->value->value.str.len = phpbind->maxsize; phpbind->value->value.str.val = emalloc(phpbind->maxsize); *************** *** 2636,2649 **** RETURN_FALSE; } if (array->type != IS_ARRAY) { if (array_init(array) == FAILURE) { php3_error(E_WARNING, "OCIFetchInto: unable to convert arg 2 to array"); RETURN_FALSE; } - } - if (!oci8_fetch(statement, nrows, "OCIFetchInto")) { - RETURN_FALSE; } for (i = 0; i < statement->ncolumns; i++) { --- 2638,2665 ---- RETURN_FALSE; } + if (!oci8_fetch(statement, nrows, "OCIFetchInto")) { + RETURN_FALSE; + } + + /* + 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?? */ + _php3_hash_destroy(array->value.ht); + efree(array->value.ht); + var_reset(array); + } + } + if (array->type != IS_ARRAY) { if (array_init(array) == FAILURE) { php3_error(E_WARNING, "OCIFetchInto: unable to convert arg 2 to array"); RETURN_FALSE; } } for (i = 0; i < statement->ncolumns; i++) { -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4954) next »