Home » Developer & Programmer » Precompilers, OCI & OCCI » Oracle OCI8 fetch of nvarchar2 column returning no data
Oracle OCI8 fetch of nvarchar2 column returning no data [message #94264] |
Wed, 23 June 2004 08:31 |
Nicholas Gray
Messages: 13 Registered: November 2000
|
Junior Member |
|
|
I'm currently trying to migrate a program working with OCI8 on varchar2 data to nvarchar2.
Database columns have been converted and now hold the corresponding UTF-16 values.
OCIEnvNlsCreate has been used:
int rc = (*OCIEnvNlsCreate_p) (&envhp, OCI_THREADED|OCI_NO_UCB, (dvoid *)0, 0, 0, 0, (size_t) 0, (dvoid **)0, OCI_WE8ISO8859P1_ID, OCI_UTF16ID);
Statement in the form of:
Select Column1, Column2, Column3, Column4 From TestTable
has been prepared
Corresponding buffers for the values have been set up and defined:
*pRlen = (ub2)0;
*pRcode = (ub2)OCI_SUCCESS;
ub2 csid = OCI_UTF16ID;
ub1 cform = SQLCS_NCHAR;
res = checkForError((*OCIDefineByPos_p) ( stmthp, &defhp[[pos]], errhp, pos, (dvoid *) pBuf, bufl, ftype, &indhp[[pos]], pRlen, pRcode, OCI_DEFAULT ));
if (res == OCI_SUCCESS && ftype == SQLT_STR && charset == SQLCS_NCHAR)
{
res = checkForError((*OCIAttrSet_p) ( (dvoid *) defhp[[pos]],
(ub4) OCI_HTYPE_DEFINE, (void *) &csid, (ub4) 0,
(ub4) OCI_ATTR_CHARSET_ID, errhp ));
res = checkForError((*OCIAttrSet_p) ( (dvoid *) defhp[[pos]],
(ub4) OCI_HTYPE_DEFINE, (void *) &cform, (ub4) 0,
(ub4) OCI_ATTR_CHARSET_FORM, errhp ));
}
however once fetch returns columns 1 and 3 return a result len of 0 and their buffers hold no data while columns 2 and 4 work as they should.
All 4 columns hold the same data, are of equal length and type.
Anyone got an idea what it is that I'm missing and how to fix it ?
PS: It's an Oracle 9.0.2 database and no error whatsoever is returned or written to any log file.
Thanks in advance.
|
|
|
|
|
Goto Forum:
Current Time: Fri Feb 07 02:05:10 CST 2025
|