Home » Developer & Programmer » Precompilers, OCI & OCCI » [OCI]Fetching VARRAYs
[OCI]Fetching VARRAYs [message #160695] Tue, 28 February 2006 01:52
Herode
Messages: 12
Registered: February 2006
Location: Isère (France, 38)
Junior Member
Hi gentlemen,

I have a piece of code to define some output variable able to "read" user-defined types. I work on an OracleSpatial base. Hence I have to manage such types as SDO_GEOMETRY and so on.
Here is the code for the define :
OCIRef* pRef; 
st = ::OCIAttrGet( pParam, OCI_DTYPE_PARAM, &pRef, 0, OCI_ATTR_REF_TDO, 
m_db.m_ses._env.m_pErr ); 
if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) return false; 

OCIType* pTdo; 
st = ::OCIObjectPin(  m_db.m_ses.m_env.m_pEnv, m_db.m_ses.m_env.m_pErr, 
pRef, NULL, OCI_PIN_ANY, OCI_DURATION_SESSION, OCI_LOCK_NONE, 
reinterpret_cast< void** >( &pTdo ) ); 
if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) return false; 

st = ::OCIDefineByPos(  m_pStmt, &pDefine, m_db.m_ses.m_env.m_pErr, i + 
1, NULL, 0, SQLT_NTY, &desc.indicator, &desc.dataSize, NULL, 
OCI_DEFAULT ); 
if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) return false; 

st = ::OCIDefineObject( pDefine, m_db.m_ses.m_env.m_pErr, pTdo, 
&desc.m_bufData, NULL, &desc.indicatorStruct, NULL ); 
if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) return false; 
[...] 

All is OK for fetching... except on some MDSYS tables. For exemple :
SQL = select sdo_diminfo from mdsys.sdo_geom_metadata_table 


For this query, the :OCIStmtFetch2 throws an exception (access
violation). The sdo_diminfo field of this table has the type : MDSYS.SDO_DIM_ARRAY
And :

SQL> desc MDSYS.SDO_DIM_ARRAY;
MDSYS.SDO_DIM_ARRAY VARRAY(4) OF MDSYS.SDO_DIM_ELEMENT
Nom Type
-----------------------------------------
SDO_DIMNAME VARCHAR2(64)
SDO_LB NUMBER
SDO_UB NUMBER
SDO_TOLERANCE NUMBER

I guess the problem is with this VARRAY. Oracle documentation says about types, for OCIRef :
(http://oraclesvca2.oracle.com/docs/cd/B10501_01/appdev.920/a96584/oci...)
Quote:


The following table lists the OCI datatypes associated with each type
of descriptor object.
Information Type OCI Datatype

Type ---> OCIType
Type Attributes Collection Elements Method Parameters Method Results
---> OCITypeElem
Method --> OCITypeMethod



However, I can't use an OCITypeElem* for OCIDefineObject...
What should I do to fetch such colums and tables ??????????????????
Previous Topic: received garbled character from Oracle database.
Next Topic: pro c
Goto Forum:
  


Current Time: Thu Mar 28 10:29:55 CDT 2024