Directory
eXtremeDB_rt/samples/vectorsDescription
Demonstrates the use of vectors and vector-based indexes
Used API
classname_vectorname_alloc(), classname_vectorname_put()
Code snippet
declare database vectors; // This sample demonstrates vectors and indexes based on vectors struct Item { uint4 id; string name; }; class Box { string name; uint4 volume; vector< string > owners; // history of the box owners vector< uint4 > repairYears; // history of the box repairs vector< uint2 > colors; // all outside colors vector< char<5> > zipcodes; // history of the box locations vector< Item > items; // things in the box tree< owners, name > I_owners; // owner and name of the box sorted tree< repairYears > I_ryears; tree< colors > I_colors; tree< zipcodes > I_zipcodes; tree< items.name, name > I_items; // ordered by item name, box name }; Box_items_alloc(&box, nitems); for (n = 0; n < nitems && MCO_S_OK == rc; n++) { rc = Box_items_put(&box, n, &item); Item_id_put(&item, next_item_id++); Item_name_put(&item, itemname, (mco_uint2)strlen(itemname)); }What to expect as an output
Creating 100 objects with vectors declared in vector.mco... .................... Mem: total pgs=5895, free pgs=5137, used and reserved 189 Kb