Reads the first logical element of a persistent sequence field.
MCO_RET classname_fieldname_first(
classname *handle,
field_type *value);
handle is a valid object handle scoped to an active read-only or read-write
transaction. value receives the first element.
MCO_S_OK: *value contains the first element.MCO_S_NOTFOUND: the sequence is empty.MCO_E_SEQ_NULL_VALUE: the first element is NULL; do not use the value buffer as an element value.Other database and transaction errors can be propagated by the generated function.
mco_int4 value;
MCO_RET rc;
rc = Sensor_readings_first(&sensor, &value);
if (rc == MCO_S_OK) {
/* use value */
}
Use classname_fieldname_iterator() with a nullable typed getter when NULL elements must be distinguished and retained.