F.5 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.
RETURN
See Appendix A "c-tree Plus Error Codes" of the c-tree Plus Programmer's Reference Guide for a complete listing of valid c-tree Plus error values.
EXAMPLE
COUNT invfilstruct invd {TEXT delflg;LONG part_no;TEXT part_name[60];LONG on_hand;} recbuf;scanf("%ld %59s %ld",&recbuf.part_no,recbuf.part_name, &recbuf.on_hand);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
The Chapter 5 "ISAM Functions" of 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, and SetOperationState.
|
FairCom Corporation www.faircom.com |