AddRecord Add a new fixed-length data record and corresponding key values to ISAM files. Short Name ADDREC() Type ISAM function fixed length record Declaration COUNT AddRecord(COUNT datno, pVOID recptr) Description AddRecord() adds the fixed-length data record pointed to by recptr to data file number datno. It automatically adds the key values defined for the data file to their respective index files. If successful, the new data record becomes the current ISAM record for data file datno. In multi-user applications, AddRecord() automatically causes a data record lock to be placed on the new record. Therefore, LockISAM(ctENABLE) and LockISAM(ctFREE) should be called before and after AddRecord(). However, with transaction processing locks are enabled and freed using Begin() and Commit(). LockCtData(ctFREE) can also be used if the record offset is known, to provide individual record lock control. Optionally, the SetOperationState() status_word OPS_UNLOCK_ADD automatically unlocks after each AddRecord(). As of c-tree Plus V8.14, c-tree sets the current ISAM position after a record is added such that the next or previous record can be read without having to re-read the record just added. Prior to V8.14, the current ISAM position was not set to a newly-added record and an INOT_ERR (101) error would result if you tried to read either the next of previous record. Return
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values. Example COUNT invfil struct invd {
TEXT delflg; LONG part_no; TEXT part_name[60]; LONG on_hand; } recbuf;
recbuf.delflg = '\0'; /* clear delete flag */ if (LockISAM(ctENABLE) || AddRecord(invfil,&recbuf) || LockISAM(ctFREE)) printf("\nAddRecord error %d in file %d",
isam_err,isam_fil); See also “ISAM Functions” in the c-tree Plus Programmer’s Reference Guide discusses how the relationship among the data files and their corresponding index files is specified. Begin(), Commit(), LockCtData(), LockISAM(), SetOperationState() |
||||||||||||||||||||||||||||||||||||