Table provides access to array of values. Table fields access is based on on record and field index.

Table interface is designed as stateless (there is no notion of cursor or simmilar mechanism).


Index of record in a table. It is 1 based.


Index of field (column) of the table.

Table & Record unification

Table and record are implented using same interface. Record can be considered to be table with only one record. When a record is needed, first record of a table is used. Possible other records ot that table are ignored. Tables support record slices, so they can be used to create 'records' from the middle of a table.

Table provider interface

This is interface implemented by table provider.

void TblFree(MemPtr table)

Free all resources allocated by table provider.

Error TblStructure(MemPtr table, Type **)

Return type of value implemented by the table. This can be either simple type (like int, data etc.), which means, that the table represent array, or it can be record type, which means the table represents collection of records.

RecIndex TblRecordCount(MemPtr table)

Number of records in the table. If some error occurs when computing number of records, the function should return 0. Maximal number of records is MAX_RECORD_INDEX.

Error TblRecordFieldValue(MemPtr table, RecIndex rec_index, FieldIndex field_index, Value * p_val)

Get the value specified value from the specified field. If there is no record with specified index (the table is shorter), ERR_INDEX is returned and the returned value is VAL_EMPTY.

Error TblSetRecordFieldValue(MemPtr table, RecIndex rec_index, FieldIndex field_index, Value val)

Set the specified value from the specified field.

Error TblDeleteRecord(MemPtr table, RecIndex rec_index)

Delete the current record in the table. Position in the record is set to following record in the table. If the deleted record was the last record in the table, the position is set after the last record (you cannot read form that position).

Error TblCreateRecord(MemPtr table, RecIndex rec_index, Record * new_record, RecIndex * p_new_rec_index)

Create new record. New record values will be initialized with specified values from record variable. If the table supports it, you can create records at specified index (inserting the data into middle of the table). If you specify 0, record is inserted at the end of the table. If you specify 1, it will be first record in the table.

Error TblMoveRecord(MemPtr table, RecIndex rec_index, RecIndex new_rec_index)

Move record to different position in the table.