Open a collection with mi_collection_open()
When you open a collection with mi_collection_open(), you obtain an update scroll cursor to hold the collection elements. Therefore, you can perform operations on a collection opened with mi_collection_open().
Cursor attribute | Valid operations |
---|---|
Read/write cursor | Insert, delete, update, fetch |
Scroll cursor | Fetch forward and backward through the collection
elements All Fetch operations are valid. (See Table 1) |
The following code fragment shows an example of using
the mi_collection_open() function to create and
open a LIST collection with INTEGER elements.
/*
* Create and open a collection
*/
MI_CONNECTION *conn;
MI_COLL_DESC *coll_desc;
MI_COLLECTION *coll_ptr;
MI_TYPEID *type_id;
...
type_id = mi_typestring_to_id(conn, "list(integer not null)");
coll_ptr = mi_collection_create(conn, type_id);
coll_desc = mi_collection_open(conn, coll_ptr);
The following figure shows the cursor position after the mi_collection_open() call.
Figure 1. Collection cursor after
the collection is opened