OCI: generic binds
Date: 25 Jun 2003 05:11:59 -0700
Message-ID: <623718a7.0306250411.70309c3a_at_posting.google.com>
I'm quite new to using OCI and I'm trying to find a way of creating a function to handle all store procedures in a database, problem I'm having is with the OCIBindByPos function and how to make the type of data being returned/input to the stored procedure generic.
I the following set up....
.
.
.
char * arrData[200];
.
.
.
/* get the number of arguments*/
checkerr(errhp, OCIAttrGet((dvoid *) arglist, OCI_DTYPE_PARAM,
(dvoid*)numArgs, (ub4*)0,(ub4)OCI_ATTR_NUM_PARAMS , errhp));
for (i=1; i<=numArgs;i++) {
OCIParamGet (arglist, OCI_DTYPE_PARAM, errhp, &arg, i);
OCIAttrGet ((dvoid *)arg, OCI_DTYPE_PARAM, (dvoid*)&atypecode, (ub4*)0, OCI_ATTR_DATA_TYPE, errhp);
OCIAttrGet ((dvoid *)arg, OCI_DTYPE_PARAM, (dvoid*)&amaxsize, (ub4*)0, OCI_ATTR_DATA_SIZE, errhp);
checkerr( errhp, OCIBindByPos(stmthp, (dvoid*)&arrOCIBind[i], errhp, i, &arrData[i] ,(sword)amaxsize , atypecode , (dvoid *) 0,(ub2 *) 0, (ub2) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT)); }
running my test harness for a stored procedure which takes two params, a SQLT_INT and SQLT_AFC out I get "OCI_NO_DATA found" from which suggests to me that data is being druncated.
Can anyone suggest what I need to change? Or is there another way altogether i should be going about this? any sample code would go down a treat!!
Thanks,
Andy. Received on Wed Jun 25 2003 - 14:11:59 CEST