using OCIDefineArrayOfStruct
Date: 29 Jul 2002 08:47:46 -0700
Message-ID: <c5345a35.0207290747.3bdaabe3_at_posting.google.com>
Hi,
I am new to OCI. I am having a problem using OCIDefineArrayOfStruct()
to query 2 columns with multiple rows. Here is a part my code.
...
typedef struct {
float rev_time; long raw_data[1500];
}tOutput;
OCIDefine *mDefinep[64];
tOutput mData[100];
checkerr(mErrhp, OCIDefineByPos(mStmthp, &mDefinep[0], mErrhp, 1,
(dvoid *) mData[0].raw_data,
(sword)sizeof(mData[0].raw_data),
SQLT_BIN,(dvoid *) 0, (ub2 *)0, (ub2 *)0, OCI_DEFAULT));
checkerr(mErrhp, OCIDefineByPos(mStmthp, &mDefinep[1], mErrhp, 2,
(dvoid *) &mData[0].rev_time, (sword) sizeof(float),
SQLT_FLT,
(dvoid *) 0, (ub2 *)0, (ub2 *)0, OCI_DEFAULT));
checkerr(mErrhp, OCIDefineArrayOfStruct(*mDefinep, mErrhp, sizeof(Output),
0, 0, 0));
/* query 100 rows at a time */
OCIStmtExecute(mSvchp, mStmthp, mErrhp, (ub4) 100, (ub4) 0,
(CONST OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT);
The result I get for mData is: mData[0].rev_time is OK for only index 0, but nothing(value 0) for the rest of the indexes. mData[0].raw_data is garbage, but for the rest of the index are valid binary numbers.
Can anyone give me any idea why?
thanks in advance for your help,
luweny Received on Mon Jul 29 2002 - 17:47:46 CEST