get
Summary
#include <dataman/dataman.h>
get(idx_name,k_buff) else ...
char *idx_name;
key k_buff;
Description
int db_g_key(idx_name, k_buff)
This procedure retrieves a record associated with a key
in an index file. The data type 'key' has been defined
through a typedef statement in the include file. All
keys used in get must be generated with the move
function. If the named key is not a member of the index
the current record remains in memory, and the else clause
is taken. If the key does exist, the index's KP is set
to the new key, the MFRP is set to the record that the
key refers to, and the record is read into memory.
Generic, and approximate key searches are fully
supported. To search for generic keys, an asterisk ('*')
may be substituted for each individual character as a
wildcard. An approximate key is just the first one or
more characters. The get function will retrieve the
first key that matches the input up to the length of the
input.
Example
#include <dataman/dataman.h>
main(argc,argv)
{
key k_buff;
...
mk_key(k_buff,"1100**6",7); /* generate key */
get(num_ix,k_buff) else { /* get a key */
... /* not there */
}
...
mk_key(k_buff,"HAN",3); /* get any "HAN" key */
get(name_ix,k_buff) else {
...
}
...
}
«previous next»