This example shows how to use ctDeferredIndexControl() to queue an index load to a background index load thread. The data file must be open by the calling connection. Set the datno field of the DFKQIL structure to the data file number. The idxlst field of the DFKQIL structure holds the file numbers of the indexes for which you want to queue an index load operation.
DFKQIL dfkqil;
LONG keynos[1];
memset(&dfkctl,0,sizeof(dfkctl));
memset(&dfkqil,0,sizeof(dfkqil));
dfkctl.verson = DFKCTL_VERS_V01;
dfkctl.opcode = DFKCTLqueueload;
dfkctl.verson = DFKCTL_VERS_V01;
dfkctl.opcode = DFKCTLqueueload;
dfkctl.bufsiz = sizeof(dfkqil);
dfkctl.bufptr = (pTEXT) &dfkqil;
dfkqil.verson = DFKQIL_VERS_V01;
dfkqil.datno = datno;
dfkqil.numidx = 1;
keynos[0] = datno + 1;
dfkqil.idxlst = &keynos;
if ((rc = ctDeferredIndexControl(&dfkctl)) != NO_ERROR) {
printf("Error: Failed to schedule index load: %d\n",
rc);
goto err_ret;
}
printf("Successfully scheduled index load.\n");