classname_fieldname_append

This function appends the supplied values to the end of the sequence.

Prototype

 
    MCO_RET	classname_fieldname_append(	/*IN*/ classname *handle, 
                            /*IN*/ TYPE *values, 
                            /*IN*/ mco_size_t n_items );
 

Arguments

handle A pointer to a classname handle

values

A pointer to the values to be appended to the sequence

n_items

The number of elements to be appended from values to the sequence

Description

This function applies to sequence fields. The supplied values are appended to the end of the sequence.

Return Codes

MCO_S_OK The value was put successfully
MCO_E_ACCESS The transaction that the class handle is scoped to is MCO_READ_ONLY

Related Topics Link IconRelated Topics

Example

 
    void populate_database(mco_db_h db)
    {
        mco_trans_h trans;
        Quote quote;
        Tick tick;
        MCO_RET rc;
        char buff[15];
        int i;
 
        for (i = 0;i < N_QUOTES; i++) 
        {
            CHECK(mco_trans_start(db, MCO_READ_WRITE, MCO_TRANS_FOREGROUND, &trans));
            generate_random_quote(&tick);
            rc = Quote_by_sym_find(trans, tick.symbol, strlen(tick.symbol), &quote);
            if (rc == MCO_S_NOTFOUND) 
            {
                CHECK(Quote_new(trans, &quote));
                CHECK(Quote_symbol_put(&quote, tick.symbol, strlen(tick.symbol)));
            } else {
                CHECK(rc);
            }
            CHECK(Quote_day_append(&quote, &tick.day, 1));
            CHECK(Quote_open_append(&quote, &tick.open, 1));
            CHECK(Quote_close_append(&quote, &tick.close, 1));
            CHECK(Quote_high_append(&quote, &tick.high, 1));
            CHECK(Quote_low_append(&quote, &tick.low, 1));
            CHECK(Quote_volume_append(&quote, &tick.volume, 1));
            sprintf(buff, "Day:%d", tick.day);
            CHECK(Quote_day_str_append(&quote, buff, 1));
            CHECK(mco_trans_commit(trans));
        }
    }