Create a Collection

To create a collection, use the mi_collection_create() function. The mi_collection_create() function is the constructor function for the collection structure (MI_COLLECTION). The collection structure includes the type of collection (LIST, MULTISET, or SET) and the element data type.

The following code shows an example of how to use the mi_collection_create() function to create a list of integers:
/*
 * Create a LIST collection with INTEGER elements 
 */
   MI_CONNECTION *conn;
   MI_TYPEID *typeid;
   MI_COLLECTION *coll;

   typeid = mi_typestring_to_id(conn, "list(integer not null)");

   if ( typeid != NULL )
      {
      coll = mi_collection_create(conn, typeid);
   ...