Results 1 to 2 of 2

Thread: OCIBIndPos

  1. #1
    Join Date
    Sep 2004

    Unanswered: OCIBIndPos

    I want to know the significance of the value_sz parameter in the OCIBindpos function does the , I mean how does it work ,
    I mean what if I specify zero for this parameter will it make a difference

  2. #2
    Join Date
    Aug 2004

    Here is what is said in the OCI Oracle doc for OCIBindByPos:

    "value_sz (IN)
    The size of a data value. In the case of an array bind, this is the maximum size of any element possible with the actual sizes being specified in the alenp parameter. For descriptors, locators, or REFs, whose size is unknown to client applications use the size of the structure you are passing in; for example, sizeof (OCILobLocator *)."

    So, this is the maximum size of your data : if you have an array of char[20] as a parameter, then value_sz must be 20 (even if all strings within the array will not be 20 characters long, "test\0" for example). In my opinion, this parameter just tells OCI the max size of your parameter so as to avoid Segmentation Faults : for example if you have an array of 10 elements which max size is 20, then OCI will know that it will go from one value of the array to the other by doing CurrentAddress+20. If your parameter is not an array, then value_sz must be the size of the parameter : sizeof(int) for an integer, 5 for "test\0" and so on. Never 0 !

    I'm more used to using OCCI (much easier !) than OCI, but I think that's it !



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts