mco_uda_cursor

Initialize a cursor.

Prototype

    MCO_RET mco_uda_cursor( /*IN*/ mco_trans_h t,
                            /*IN*/ unsigned short struct_no,
                            /*IN*/ unsigned short index_no,
                            /*OUT*/ mco_cursor_t * cursor );

Arguments

t
The transaction handle.
struct_no
The structure/class number (must be between 0 and mco_dict_struct_count() - 1).
index_no
The index number (must be between 0 and struct_info.index_count - 1).
cursor
Address of a mco_cursor_t struct variable to receive the cursor handle.

Description

Initializes a cursor based on the index specified through its number index_no.

Return Codes

MCO_S_OK
The cursor was returned successfully.
MCO_E_UDA_STRUCT_NOTFOUND
Invalid struct_no.
MCO_E_UDA_STRUCT_NOT_CLASS
Invalid struct_no (not a class).
MCO_E_UDA_INDEX_NOTFOUND
Invalid index_no.

Example

    Application snippet:

    int main(int argc, char** argv)
    {
        MCO_RET rc;
        mco_db_h db;
        mco_trans_h t;
        mco_cursor_t cursor;
        unsigned short struct_no = 1;
        unsigned short index_no = 5;
        ...

        rc = mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &t);
        if ( MCO_S_OK == rc )
        {
            rc = mco_uda_cursor(t, struct_no, index_no, &cursor);

            for ( ; rc == MCO_S_OK; rc = mco_cursor_next(t, &cursor))
            {
                mco_uda_object_handle_t obj;
                /* get object handle */
                mco_uda_from_cursor(t, &cursor, &obj);
                ...
            }
            rc = mco_trans_rollback(t);
        }
    }

Files

Header file:
mcouda.h
Source file:
mcouda.c
Library:
libmcouda.a