D_FILLNEW(1)

NAME
d_fillnew - insert a new record

SYNOPSIS
#include <typhoon.h>
d_fillnew(ulong recid, void *buf)

DESCRIPTION
d_fillnew inserts a new record in a table. recid specifies the type of the record stored in buf. The inserted record retains the same database address throughout its life in the database.

DIAGNOSTICS
The status code returned by the function is also stored in the global variable db_status.

S_OKAY
    The record was successfully inserted.

S_NOCD
    There is no current database.

S_INVREC
    The record id is not valid.

S_DUPLICATE
    One of the keys in the record would cause duplicates in a unique index. db_subcode contains the id of the conflicting field or key.

S_RECSIZE
    A length determinator of a variable length field contained a illegal value. db_subcode contains the id of the conflicting field.

S_FOREIGN
    The target of a foreign key could not be found. db_subcode contains the id of the target table.

CURRENCY CHANGES
If d_fillnew returned S_OKAY the record becomes the current record.

EXAMPLE
#include <typhoon.h> struct customer cust;
strcpy(cust.name, "Pedersen");
cust.account = 10002; if( d_fillnew(CUSTOMER, &cust) != S_OKAY )
    /* handle error */

IDENTIFICATION
Author: Thomas B. Pedersen.
Copyright (c) 1994 Thomas B. Pedersen.

SEE ALSO
d_recwrite(1)