CVS update: php3/functions

From: Date: Fri, 19 Feb 1999 08:30:45 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4155@lists.php.net to get a copy of this message
Date: Friday February 19, 1999 @ 3:30 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv17256 Modified Files: oci8.c php3_oci8.h Log Message: we no get the REAL column size back from oracle instead of using strlen! Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.55 php3/functions/oci8.c:1.56 *** php3/functions/oci8.c:1.55 Thu Feb 18 14:12:49 1999 --- php3/functions/oci8.c Fri Feb 19 03:30:45 1999 *************** *** 32,38 **** +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.55 1999/02/18 19:12:49 thies Exp $ */ #include "php.h" #include "internal_functions.h" --- 32,38 ---- +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.56 1999/02/19 08:30:45 thies Exp $ */ #include "php.h" #include "internal_functions.h" *************** *** 156,161 **** --- 156,163 ---- /* bind callback functions */ static sb4 oci8_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **); static sb4 oci8_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **); + /* define callback function */ + static sb4 oci8_define_callback(dvoid *, OCIDefine *, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **); /* }}} */ /* {{{ extension function prototypes */ *************** *** 740,746 **** break; case 0: /* intact value */ ! size = strlen(column->data); /* everything is now a NULL terminated string */ break; case -1: /* we hit a NULL value, return empty string or uninitialized value */ --- 742,748 ---- break; case 0: /* intact value */ ! size = column->rlen; break; case -1: /* we hit a NULL value, return empty string or uninitialized value */ *************** *** 751,758 **** value->type = IS_STRING; value->value.str.len = size; ! value->value.str.val = emalloc(size); ! memcpy(value->value.str.val, column->data, size); } return 0; --- 753,759 ---- value->type = IS_STRING; value->value.str.len = size; ! value->value.str.val = estrndup(column->data,size); } return 0; *************** *** 985,991 **** (sb4)-1, define_type, (dvoid *)&outcol->indicator, ! (ub2 *)0, (ub2 *)&outcol->retcode, OCI_DEFAULT); break; --- 986,992 ---- (sb4)-1, define_type, (dvoid *)&outcol->indicator, ! (ub2 *)&outcol->rlen, (ub2 *)&outcol->retcode, OCI_DEFAULT); break; *************** *** 1022,1027 **** --- 1023,1029 ---- return 0; } + def_error = OCIDefineByPos( statement->pStmt, /* IN/OUT handle to the requested SQL query */ (OCIDefine **)&outcol->pDefine, /* IN/OUT pointer to a pointer to a define handle */ *************** *** 1031,1039 **** outcol->storage_size, /* 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_DEFAULT); /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */ break; } --- 1033,1057 ---- outcol->storage_size, /* 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->rlen, /* IN/OUT Pointer to array of length of data fetched */ (ub2 *)&outcol->retcode, /* OUT Pointer to array of column-level return codes */ OCI_DEFAULT); /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */ + + #if 0 + + sword OCIDefineDynamic ( OCIDefine *defnp, + OCIError *errhp, + dvoid *octxp, + OCICallbackDefine (ocbfp)(/*_ + dvoid *octxp, + OCIDefine *defnp, + ub4 iter, + dvoid **bufpp, + ub4 **alenpp, + ub1 *piecep, + dvoid **indpp, + ub2 **rcodep _*/) ); + #endif break; } *************** *** 1046,1051 **** --- 1064,1070 ---- return 0; } + } } return 1; *************** *** 1081,1087 **** if (column->define) { pval = column->define->pval; ! pval->value.str.len = strlen(pval->value.str.val); pval->value.str.val[ pval->value.str.len ] = 0; } } --- 1100,1106 ---- if (column->define) { pval = column->define->pval; ! pval->value.str.len = column->rlen; pval->value.str.val[ pval->value.str.len ] = 0; } } *************** *** 1164,1169 **** --- 1183,1231 ---- return loblen; } + /* }}} */ + static sb4 oci8_define_callback(dvoid *, OCIDefine *, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **); + /* {{{ oci8_define_callback() */ + + static sb4 + oci8_define_callback(dvoid *octxp, + OCIDefine *defnp, + ub4 iter, /* 0-based execute iteration value */ + dvoid **bufpp, /* pointer to data */ + ub4 **alenp, /* size after value/piece has been read */ + ub1 *piecep, /* which piece */ + dvoid **indpp, /* indicator value */ + ub2 **rcodep) + { + #if 0 + oci8_bind *phpbind; + pval *val; + + phpbind = (oci8_bind *)ictxp; + + if (!phpbind || !(val = phpbind->value)) { + php3_error(E_WARNING, "!phpbind || !phpbind->val"); + return OCI_ERROR; + } + + if (phpbind->descr == 0) { /* "normal string bind */ + convert_to_string(val); + + *bufpp = val->value.str.val; + *alenp = phpbind->maxsize; + *indpp = (dvoid *)&phpbind->indicator; + } else { /* descriptor bind */ + *bufpp = phpbind->descr; + *alenp = -1; /* seems to be allright */ + *indpp = (dvoid *)&phpbind->indicator; + } + + *piecep = OCI_ONE_PIECE; /* pass all data in one go */ + #endif + + return OCI_CONTINUE; + } + /* }}} */ /* {{{ oci8_bind_in_callback() */ Index: php3/functions/php3_oci8.h diff -c php3/functions/php3_oci8.h:1.28 php3/functions/php3_oci8.h:1.29 *** php3/functions/php3_oci8.h:1.28 Thu Feb 18 08:06:03 1999 --- php3/functions/php3_oci8.h Fri Feb 19 03:30:45 1999 *************** *** 114,119 **** --- 114,120 ---- ub2 storage_size; sb2 indicator; ub2 retcode; + ub2 rlen; ub2 is_descr; int descr; void *data; -- 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 (#4155) next »