NULL indicator DefineByPos & StmtFetch
I am using OCI to connect my Application to an Oracle 8 Server.
I am trying now to make a simple select like a <select * from ..> , try to
retrieve the rowinfo and the rows
1. retrieving the columncount
AttrGet: statementHandle asParameter
handletype: OCI_HTYPE_STMT asParameter
attributevalue: longBuffer asParameter
size: 0 asParameter
attributtype: OCI_ATTR_PARAM_COUNT asParameter
errorHandle: errHandle asParameter.
2. Retrieving the column infos for all columns
ret := ociDLL oCIParamGet: statementHandle asParameter
htype: OCI_HTYPE_STMT asParameter
errorHandle: errHandle asParameter
parameterHandle: longBuffer asParameter
pos: i asParameter .
(ret == OCI_SUCCESS) ifFalse: [ociDLL oCIErrorGet: errHandle type:
OCI_HTYPE_ERROR ].
parameterHandle := longBuffer csContext .
ret := ociDLL oCIAttrGet: parameterHandle asParameter
handletype: OCI_DTYPE_PARAM asParameter
attributevalue: longBuffer2 asParameter
size: 0 asParameter
attributtype: OCI_ATTR_NAME asParameter
errorHandle: errHandle asParameter.
colname := (String fromAddress: longBuffer2 contents ) trimBlanks .
...
3. setting the defineByPos
ret := ociDLL oCIDefineByPos: statementHandle asParameter
defineHandle: defineHandle asParameter
errHandle: errHandle asParameter
position: i asParameter
value: val asParameter
valuesize: (rowDescr getMaxLen: i) asParameter
datatype: (rowDescr getType: i) asParameter
indicatorpointer: ind asParameter
rlenp: 0 asParameter
rcodep: err asParameter
mode: OCI_DEFAULT asParameter.
My select has NULL values, i tried to used the indicator pointer to catch
that, but the value I have in it is not correct. ALso the value in rcodep
is not correct. I also don't receive an OCI_SUCCESS_WITH_INFO as retcode for the OciStmtFetch()
Do I neeed another call to oci before or any ideas?
Thanks in advance