Generated Sequence Field Functions
For every sequence<T> field, the schema compiler generates a family of C functions named
classname_fieldname_operation(). These functions connect persistent sequence fields
to the iterator-based C Sequence API.
Common rules
- Positions are zero-based. Range endpoints accepted by
delete and subseq are inclusive.
- Read operations are valid in read-only and read-write transactions. Operations that modify a field require a read-write
transaction and can return
MCO_E_ACCESS otherwise.
- An iterator created from a field is lazy and remains tied to the transaction, object handle, cursor, and operand iterators
from which it was created. Keep those objects valid until iteration finishes.
- Use the iterator's installed
reset callback to traverse it again. Do not assume that every generated operation
installs the same reset implementation.
- For a nullable sequence element, a set bit in the null bitmap denotes SQL
NULL. The bitmap contains at least
(n_items + 63) / 64 values of type mco_bitmap_word_t.
- A nullable sequence field and nullable elements are independent concepts. The generated
indicator_get and
indicator_put functions control whether the whole field is NULL; the functions on this page operate on its elements.
- Ordered sequence fields preserve their declared order. Appending or inserting values that violate it returns
MCO_E_SEQ_OUT_OF_ORDER.
Ordered fields additionally receive search and join functions.
- The same generated API works with plain and RLE sequence libraries. Counts and positions are always logical element counts
and positions; typed traversal expands RLE runs.
Generated operations
Read the first logical element.
Read the last logical element.
Append non-null elements.
Append elements with a null bitmap.
Insert non-null elements at a logical position.
Insert elements and their null bitmap.
Delete an inclusive logical range.
Iterate values in an ordered value range.
Map ordered input values to positions in this field.
Return the logical element count.
Select elements by arbitrary logical positions.
Iterate an inclusive forward or reverse range.
Iterate the complete field.
Concatenate this field across objects visited by a cursor.
Apply another iterator's current positional range to this field.
Append the remaining elements of an iterator to this field.
Element types
The placeholder field_type used in the function pages is the generated C type for the sequence
element. Fixed-width char<N> elements occupy exactly N bytes and are passed as
contiguous fixed-size records; they are not required to be null-terminated strings.
See mco_seq_iterator_t for the iterator contract
and Fixed-Width Character Sequences for character-specific rules.