Pegasus InfoCorp: Web site design and web software development company

D_KEYFRST (1)

find the first key value in an index

SYNOPSIS

    #include <typhoon.h>

    d_keyfrst(ulong keyid)

DESCRIPTION

    d_keyfrst finds the first key value in the index specified by keyid. If d_keyfrst returns S_NOTFOUND the index is empty.

    The id can be either the id of a compound key or a field that is a key by itself.

    The actual record is not read from the database until d_recread(1) is called.

DIAGNOSTICS

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

    S_OKAY

      The key value was found.

    S_NOTFOUND

      The key value was not found, i.e. the index is empty.

    S_NOCD

      There is no current database.

    S_INVFLD

      The id is not a valid field.

    S_NOTKEY

      The field id is not a key itself.

CURRENCY CHANGES

    If S_OKAY is returned, the record found becomes the current record.

EXAMPLE

    /* Traverse the customers in alphabetical, ascending order */

    #include <typhoon.h>

    d_keyfrst(CUSTOMER_NAME);

    while( db_status == S_OKAY ) { struct customer cust;

    d_recread(&cust); printf("%s\\n", cust.name); d_keynext(CUSTOMER_NAME); }

IDENTIFICATION

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

SEE ALSO