D_KEYNEXT (1)
find the next key value in an index
SYNOPSIS
#include <typhoon.h>
d_keynext(ulong keyid)
DESCRIPTION
d_keynext finds the next key value greater than or equal to the
current key value in the index specified by
keyid. If d_keynext returns S_NOTFOUND the end of the index
has been passed. A subsequent call to d_keynext will return the first
key value in the index.
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
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 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
|