classname_indexname_search

Search methods search the database based on a supplied opcode. Subsequent to the search operation, the cursor is positioned at the first object that matches the given parameters.

Prototype

    MCO_RET classname_indexname_search(    /*IN*/ mco_trans_h trans,
                           /*INOUT*/ mco_cursor_h cursor,
                           /*IN*/ MCO_OPCODE op,
                           /*IN*/ [const] <type> [*]param1,
                           [[/*IN*/ uint2 len1,],
                           [/*IN*/ [const] <type> [*]param2,
                            [/*IN*/ uint2 len2,] ...]);

Arguments

trans
A transaction handle returned by mco_trans_start().
cursor
A cursor handle created by classname_indexname_index_cursor().
op
An opcode from enum MCO_OPCODE.
param1
A variable of type type, where type is the data type of the classname.fieldname component of the index. If the index component is char or string, the param is a const char *.
len1
If param1 is a char or string, len1 specifies the length of the input buffer.
param2
If the index has more than one component (is a compound index) a search value is input for each component of the index.
len2
If param2 thru paramN are char or string, each such parameter argument is followed by a lenN parameter to specify the length of the paramN buffer.

Description

Search methods search the database based on a supplied opcode. Subsequent to the search operation, the cursor is positioned at the first object that matches the given parameters.

    typedef enum MCO_OPCODE_E_
    {
        MCO_LT        = 1,
        MCO_LE        = 2,
        MCO_EQ        = 3,
        MCO_GE        = 4,
        MCO_GT        = 5
    } MCO_OPCODE;

Return Codes

MCO_S_OK
The cursor was positioned successfully.
MCO_S_NOTFOUND
The search values did not match any object of the class.
MCO_E_VOLUNTARY_NOT_EXIST
indexname is voluntary and has not been created, or was dropped.
MCO_E_ILLEGAL_PARAM
Illegal search operation code.
MCO_E_NOMEM
Out of memory.
MCO_ERR_CURSOR
Fatal error in cursor operation.
Related Topics Link IconRelated Topics