Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

CTDB_ON_RECORD_MAPTOCHILD

Called only if the the child table has the field mapping resource activated.Overrides the field mapping information, that is, if the callback function pointers are set, then the field mapping information stored in the child table resource is ignored and the callback function is responsible for copying the appropriate fields from the child record buffer to the parent record buffer (and vice-versa).

The ctrouter.exe utility should be used to create a field mapping resource to the child table. Once the field mapping resource is set, and after the table is open by calling ctdbOpenTable() function, the two callback type mentioned above can be set to provide custom field mapping to and from the child table. It is recommended to set both CTDB_ON_RECORD_MAPTOPARENT and CTDB_ON_RECORD_MAPTOCHILD using a table handle, as this will automatically set the callbacks for any records allocated using the table handle. Example:

/* open the child table */

if ((Retval = ctdbOpenTable(hTable, "child", CTOPEN_NORMAL)) == CTDBRET_OK)

{

ctdbSetCallback(hTable, CTDB_ON_RECORD_MAPTOPARENT, MapToParent);

ctdbSetCallback(hTable, CTDB_ON_RECORD_MAPTOCHILD, MapToChild);

}

TOCIndex