Table 21-6 lists the Any Data Set Interface functions that are described in this section.
Table 21-6 Any Data Set Functions
Function | Purpose |
---|---|
Add a new skeleton instance to the |
|
Allocate an |
|
Free the |
|
Mark the end of |
|
Get the number of instances in the |
|
Return the |
|
Get the type corresponding to an |
Adds a new skeleton instance to the OCIAnyDataSet
and sets all the attributes of the instance to NULL
.
sword OCIAnyDataSetAddInstance ( OCISvcCtx *svchp, OCIError *errhp, OCIAnyDataSet *data_set, OCIAnyData **data );
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 OCIErrorGet().
OCIAnyDataSet
to which a new instance is added.
OCIAnyData
corresponding to the newly added instance. If (*data)
is NULL
, a new OCIAnyData
is allocated for the same duration as the OCIAnyDataSet
. If (*data)
is not NULL
, it is reused. This OCIAnyData
can be subsequently constructed using the OCIAnyDataConvert() call, or it can be constructed piece-wise using the OCIAnyDataAttrSet() or the OCIAnyDataCollAddElem() calls.
This call returns this skeleton instance through the OCIAnyData
parameter that can be constructed subsequently by invoking the OCIAnyData API.
Note:
The old value is not destroyed. You must destroy the old value pointed to by (*data
) and set (*data
) to a NULL
pointer before beginning to make a sequence of these calls. No deep copying (of OCIType
information or of the data part) is done in the returned OCIAnyData
. This OCIAnyData
cannot be used beyond the allocation duration of the OCIAnyDataSet
(it is like a reference into the OCIAnyDataSet
). The returned OCIAnyData
can be reused on subsequent calls to this function, to sequentially add new data instances to the OCIAnyDataSet
.Allocates an OCIAnyDataSet
for the given duration and initializes it with the type information. The OCIAnyDataSet
can hold multiple instances of the given type.
sword OCIAnyDataSetBeginCreate ( OCISvcCtx *svchp, OCIError *errhp, OCITypeCode typecode, const OCIType *type, OCIDuration dur, OCIAnyDataSet **data_set );
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 OCIErrorGet().
Typecode corresponding to the OCIAnyDataSet
.
Type corresponding to the OCIAnyDataSet
. If the typecode corresponds to a built-in type, such as OCI_TYPECODE_NUMBER
, this parameter can be NULL
. It should be non-NULL
for user-defined types, such as OCI_TYPECODE_OBJECT
, OCI_TYPECODE_REF
, and collection types.
Duration for which OCIAnyDataSet
is allocated. It is one of these:
Initialized OCIAnyDataSet
.
For performance reasons, the OCIAnyDataSet
ends up pointing to the OCIType
parameter passed in. You must ensure that the OCIType
lives longer (has an allocation duration >= the duration of the OCIAnyData
if the OCIType
is a transient one, or has allocation or pin duration >= the duration of the OCIAnyData
, if the OCIType
is a persistent one).
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 OCIErrorGet().
OCIAnyDataSet
to be freed.
Marks the end of OCIAnyDataSet
creation. This function should be called after constructing all of its instances.
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 OCIErrorGet().
Initialized OCIAnyDataSet
.
sword OCIAnyDataSetGetCount( OCISvcCtx *svchp, OCIError *errhp, OCIAnyDataSet *data_set, ub4 *count );
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 OCIErrorGet().
A well-formed OCIAnyDataSet
.
Number of instances in OCIAnyDataSet
.
Returns the OCIAnyData
corresponding to an instance at the current position and updates the current position.
sword OCIAnyDataSetGetInstance ( OCISvcCtx *svchp, OCIError *errhp, OCIAnyDataSet *data_set, OCIAnyData **data );
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 OCIErrorGet().
A well-formed OCIAnyDataSet
.
OCIAnyDat
a corresponding to the instance. If (*data) is NULL
, a new OCIAnyData
is allocated for same duration as the OCIAnyDataSet
. If (*data
) is not NULL
, it is reused.
sword OCIAnyDataSetGetType ( OCISvcCtx *svchp, OCIError *errhp, OCIAnyDataSet *data_set, OCITypeCode *tc, OCIType **type );
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 OCIErrorGet().
Initialized OCIAnyDataSet
.
The typecode corresponding to the type of the OCIAnyDataSet
.
The type corresponding to the OCIAnyDataSet
. This is NULL
if the OCIAnyData
corresponds to a built-in type.