|Oracle Call Interface Programmer's Guide
Part Number A89857-01
OCI Any Type and Data Functions, 13 of 25
Constructs an OCIAnyData with the given data value which will be of the given type. This call can be used to construct an entire OCIAnyData which could be of type OCI_TYPECODE_OBJECT, any of the collection types, or any of the built-in types.
OCIAnyDataConvert ( OCISvcCtx *svchp, OCIError *errhp, OCITypeCode tc, OCIType *inst_type, OCIDuration dur, dvoid *null_ind, dvoid *data_value, ub4 length, OCIAnyData **sdata );
The OCI service context.
The OCI error handle. If there is an error, it is recorded in
err and this function returns OCI_ERROR. Obtain diagnostic information by calling
Typecode of the data value. Can be a built-in typecode or a user-defined type's typecode (such as OCI_TYPECODE_OBJECT, OCI_TYPECODE_REF, OCI_TYPECODE_VARRAY).
*sdata) is not null and it represents a skeleton instance returned during the
tc as well as the
inst_type parameters are optional here. This is because the type-information for such a skeleton instance is already known. If the
inst_type parameters are provided here for this situation, they will be used only for type-checking purposes.
Type corresponding to the OCIAnyData. If the typecode corresponds to a built-in type (OCI_TYPECODE_NUMBER, etc.), this parameter can be null. It should not be null for user defined types (OCI_TYPECODE_OBJECT, OCI_TYPECODE_REF, or collection types).
Duration for which the OCIAnyData is allocated. One of the following:
data_value is null. Pass an
(OCIInd *) for all typecodes except OCI_TYPECODE_OBJECT. The indicator will be OCI_IND_NOTNULL if the value is not null and it will be OCI_IND_NULL for a null value.
If the typecode is OCI_TYPECODE_OBJECT, pass a pointer to the indicator struct of the
data_value as the argument here.
Currently, this parameter is ignored. Pass 0 here. In the future, this may be used for certain typecodes where the data representation itself will not give the length implicitly.
Initialized OCIAnyData. If (
*sdata) is not null at the beginning of the call, the memory could bet reused instead of reallocating space for the OCIAnyData.
Therefore, do not pass an un-initialized pointer here.
*sdata) represents a skeleton instance returned during an
OCIAnyDataSetAddInstance() call, the
inst_type parameters will be used for type-checking purposes if necessary.
For performance reasons, the OCIAnyData pointer will end up pointing to the passed in OCIType parameter. It is your responsibility to ensure that the OCIType is longer lived (has allocation duration >= the duration of the OCIAnyData, if the OCIType is a transient one, or has allocation/pin duration >= duration of the OCIAnyData, if the OCIType is a persistent one).