This function appends the supplied values to the end of the sequence.
MCO_RET classname_fieldname_append( /*IN*/ classname *handle, /*IN*/ TYPE *values, /*IN*/ mco_size_t n_items );
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 |
This function applies to sequence fields. The supplied values are appended to the end of the sequence.
MCO_S_OK | The value was put successfully |
MCO_E_ACCESS | The transaction that the class handle is scoped to is MCO_READ_ONLY |
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), "e); if (rc == MCO_S_NOTFOUND) { CHECK(Quote_new(trans, "e)); CHECK(Quote_symbol_put("e, tick.symbol, strlen(tick.symbol))); } else { CHECK(rc); } CHECK(Quote_day_append("e, &tick.day, 1)); CHECK(Quote_open_append("e, &tick.open, 1)); CHECK(Quote_close_append("e, &tick.close, 1)); CHECK(Quote_high_append("e, &tick.high, 1)); CHECK(Quote_low_append("e, &tick.low, 1)); CHECK(Quote_volume_append("e, &tick.volume, 1)); sprintf(buff, "Day:%d", tick.day); CHECK(Quote_day_str_append("e, buff, 1)); CHECK(mco_trans_commit(trans)); } }