The mi_collection_card() function

The mi_collection_card() function returns a count of the elements in a collection (that is, its cardinality).

Syntax

mi_integer mi_collection_card(coll_ptr, isnull)
   MI_COLLECTION *coll_ptr;
   mi_boolean *isnull;
coll_ptr
A valid pointer to a collection structure.
isnull
A valid pointer to an SQL NULL indicator flag, which can have either of the following values:
MI_TRUE
The collection value is SQL NULL.
MI_FALSE
The collection value is not SQL NULL. The collection contains zero or more elements.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_collection_card() function returns the cardinality of the collection that coll_ptr references. The collection value can be SQL NULL, in which case the isnull flag is set to MI_TRUE and the return value is 0. A collection does not have to be open for mi_collection_card() to obtain its cardinality.

Return values

0
(isnull = MI_TRUE) indicates the collection value is SQL NULL.
>=0
(isnull = MI_FALSE) provides the cardinality of the collection.
MI_ERROR
An invalid parameter.