• Antelope Release 5.2-64 Mac OS X 10.6.8 2012-04-24

 

NAME

dbadd, dbaddchk - add a record to table

SYNOPSIS

#include "db.h"

long dbadd(Dbptr db, char *rec)

long dbaddchk(Dbptr db, char *rec)

DESCRIPTION

dbadd adds a new row to the table pointed to by db. The new row is taken from rec, or if rec is zero, from the scratch record for that table. (Thus the scratch record may be used to build up a new record before adding it to a table).

dbaddchk is like dbadd, but checks the destination table for conflicting records -- with the same primary or alternate key -- before performing the add.

RETURN VALUES

dbadd returns the record number of the added record, or dbINVALID if an error occurred. In the latter case, no record is added.

dbaddchk returns the record number of the added record if it's successful, and a number less than zero if it fails. Negative return values are either dbINVALID, or dbINVALID - matching_record_number - 1. In addition, an error message providing more detail is left on the error log.

LIBRARY

$(DBLIBS)

DIAGNOSTICS

db must be specified to the table level.

SEE ALSO

dbaddv(3)
dbaddnull(3)
dbdelete(3)

BUGS AND CAVEATS

No check is made to ensure that the record has the right length; the record must have the correct length, as exactly that many bytes are copied from rec or the table's scratch record.

AUTHOR

Daniel Quinlan
Printer icon