OCI: generic binds

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy

    #1

    OCI: generic binds

    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((dvo id *) arglist, OCI_DTYPE_PARAM ,
    (dvoid*)numArgs , (ub4*)0,(ub4)OC I_ATTR_NUM_PARA MS , errhp));

    for (i=1; i<=numArgs;i++ ) {

    OCIParamGet (arglist, OCI_DTYPE_PARAM , errhp, &arg, i);

    OCIAttrGet ((dvoid *)arg, OCI_DTYPE_PARAM , (dvoid*)&atypec ode,
    (ub4*)0, OCI_ATTR_DATA_T YPE, errhp);

    OCIAttrGet ((dvoid *)arg, OCI_DTYPE_PARAM , (dvoid*)&amaxsi ze,
    (ub4*)0, OCI_ATTR_DATA_S IZE, errhp);

    checkerr( errhp, OCIBindByPos(st mthp, (dvoid*)&arrOCI Bind[i],
    errhp, i, &arrData[i] ,(sword)amaxsiz e , 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_DAT A 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.
Working...