| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> [10g1][C++] Defining types and collections with OCI
Hi gentlemen,
I have a piece of code to define some output variable able to "read" non-trivial 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 :
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; [...]
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/oci11oty.htm#426838)
:
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 ??????????????????Received on Mon Feb 27 2006 - 05:07:50 CST
![]() |
![]() |