CVS update: php3/functions

From: Date: Mon, 22 Feb 1999 12:21:37 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4244@lists.php.net to get a copy of this message
Date: Monday February 22, 1999 @ 7:21 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv24065 Modified Files: oci8.c php3_oci8.h Log Message: define size is now adjusted for NUMBER and DATE column-types. there is a weird problem with oracle reporting truncated columns. Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.59 php3/functions/oci8.c:1.60 *** php3/functions/oci8.c:1.59 Sun Feb 21 07:27:58 1999 --- php3/functions/oci8.c Mon Feb 22 07:21:37 1999 *************** *** 32,38 **** +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.59 1999/02/21 12:27:58 thies Exp $ */ #include "php.h" #include "internal_functions.h" --- 32,38 ---- +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.60 1999/02/22 12:21:37 thies Exp $ */ #include "php.h" #include "internal_functions.h" *************** *** 703,708 **** --- 703,711 ---- 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); *************** *** 744,760 **** /* there is NO free call here, 'cause the memory gets deallocated together with the statement! */ } } else { ! switch (column->indicator) { ! case -2: /* truncated value */ ! oci8_debug("%s: truncated column", func); ! size = column->rlen; break; case 0: /* intact value */ size = column->rlen; break; - case -1: /* we hit a NULL value, return empty string or uninitialized value */ default: /* XXX we SHOULD maybe have a different behaviour for unknown results! */ var_reset(value); return 0; --- 747,762 ---- /* there is NO free call here, 'cause the memory gets deallocated together with the statement! */ } } else { ! switch (column->retcode) { ! case 1406: /* truncated value */ ! oci8_debug("%s: truncated column %s", func,column->name); ! size = column->indicator; break; case 0: /* intact value */ size = column->rlen; break; default: /* XXX we SHOULD maybe have a different behaviour for unknown results! */ var_reset(value); return 0; *************** *** 1010,1016 **** default: define_type = SQLT_STR; ! outcol->storage_size4++; /* add one for string terminator */ break; } --- 1012,1022 ---- default: define_type = SQLT_STR; ! if ((outcol->type == SQLT_DAT) || (outcol->type == SQLT_NUM)) { ! outcol->storage_size4 = 127; /* XXX this should fit "most" NLS date-formats and Numbers */ ! } else { ! outcol->storage_size4++; /* add one for string terminator */ ! } break; } *************** *** 1026,1032 **** outcol->storage_size4, /* IN The size of each valuep buffer in bytes */ define_type, /* IN The data type */ (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */ ! (ub2 *)0, /* IN/OUT Pointer to array of length of data fetched */ (ub2 *)&outcol->retcode, /* OUT Pointer to array of column-level return codes */ OCI_DYNAMIC_FETCH)); /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */ if (error) { --- 1032,1038 ---- outcol->storage_size4, /* IN The size of each valuep buffer in bytes */ define_type, /* IN The data type */ (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */ ! (ub2 *)&outcol->size2, /* IN/OUT Pointer to array of length of data fetched */ (ub2 *)&outcol->retcode, /* OUT Pointer to array of column-level return codes */ OCI_DYNAMIC_FETCH)); /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */ if (error) { *************** *** 1184,1189 **** --- 1190,1196 ---- outcol = (oci8_out_column *)octxp; define = outcol->define; + if (outcol->is_descr) { if (define && (! outcol->pdescr)) { /* column has been user-defined */ if (_php3_hash_find(define->pval->value.ht, "descriptor", sizeof("descriptor"), (void **)&tmp) == FAILURE) { *************** *** 1255,1266 **** *bufpp = outcol->data; } *alenp = &outcol->rlen; *indpp = &outcol->indicator; *rcodep = &outcol->retcode; - *piecep = OCI_ONE_PIECE; ! return OCI_CONTINUE; } --- 1262,1278 ---- *bufpp = outcol->data; } + outcol->indicator = 0; + outcol->retcode = 0; + *alenp = &outcol->rlen; *indpp = &outcol->indicator; *rcodep = &outcol->retcode; *piecep = OCI_ONE_PIECE; ! ! oci8_debug("oci8_define_callback: %s,*bufpp = %x,**alenp = %d,**indpp = %d, **rcodep= %d, *piecep = %d", ! outcol->name,*bufpp,**alenp,**(ub2**)indpp,**rcodep,*piecep); ! return OCI_CONTINUE; } *************** *** 1386,1392 **** } convert_to_long(stmt); ! statement = oci8_get_stmt(stmt->value.lval, "OCIBindByName", list); if (statement == NULL) { RETURN_FALSE; } --- 1398,1404 ---- } convert_to_long(stmt); ! statement = oci8_get_stmt(stmt->value.lval, "OCIDefineByName", list); if (statement == NULL) { RETURN_FALSE; } Index: php3/functions/php3_oci8.h diff -c php3/functions/php3_oci8.h:1.31 php3/functions/php3_oci8.h:1.32 *** php3/functions/php3_oci8.h:1.31 Fri Feb 19 09:26:50 1999 --- php3/functions/php3_oci8.h Mon Feb 22 07:21:37 1999 *************** *** 113,118 **** --- 113,119 ---- ub2 type; ub4 size4; ub4 storage_size4; + ub2 size2; sb2 indicator; ub2 retcode; ub4 rlen; -- 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 (#4244) next »