Difference between revisions of "Dbkexpr()"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 15: | Line 15: | ||
<output parameters> | <output parameters> | ||
char keytype; /* Index key data type: | char keytype; /* Index key data type: | ||
− | + | 'C' – CHARACTER | |
− | + | 'N' – NUMERIC | |
− | + | 'D' – DATE */ | |
char *keyexpr; /* Index key expression */ | char *keyexpr; /* Index key expression */ | ||
int *kexprlen; /* Length of index key expression */ | int *kexprlen; /* Length of index key expression */ | ||
Line 46: | Line 46: | ||
#include "dbl.h" | #include "dbl.h" | ||
− | char *ndx; /* .NDX file descriptor */ | + | char *ndx; /* .NDX file descriptor */ |
− | char keytype; /* Key type | + | char keytype; /* Key type */ |
− | char keyexpr[512]; /* Index key expression */ | + | char keyexpr[512]; /* Index key expression */ |
− | int keyexprlen; /* Expression length | + | int keyexprlen; /* Expression length */ |
− | int keylen; /* Key length | + | int keylen; /* Key length */ |
− | int rc; /* Return code | + | int rc; /* Return code */ |
rc = dbkexpr(ndx, &keytype, keyexpr, &keyexprlen, &keylen); | rc = dbkexpr(ndx, &keytype, keyexpr, &keyexprlen, &keylen); |
Latest revision as of 13:32, 1 May 2009
PURPOSE
get key expression
SYNOPSIS
#include "dbl.h" int dbkexpr(ndx, keytype, keyexpr, keyprlen, keylen) <input parameters> char *ndx; /* .NDX file descriptor */ <output parameters> char keytype; /* Index key data type: 'C' – CHARACTER 'N' – NUMERIC 'D' – DATE */ char *keyexpr; /* Index key expression */ int *kexprlen; /* Length of index key expression */ int *keylen; /* Index key length */
RETURN VALUE
The dbkexpr() function returns 0 for success, or < 0 if an error occurs. See the section on return code values for a detailed list of return codes.
DESCRIPTION
This function obtains the index information from the specified .NDX file. This information includes:
- index key data type('C' for CHARACTER keys, 'N' for NUMERIC and 'D' for DATE),
- index key expression (usually a character string consisting of one or more record field names)
- length of the index key expression
- length of the key.
EXAMPLE
This example obtains the index information from the .NDX file whose file descriptor is in "char *ndx" and prints this information on standard output.
#include "dbl.h" char *ndx; /* .NDX file descriptor */ char keytype; /* Key type */ char keyexpr[512]; /* Index key expression */ int keyexprlen; /* Expression length */ int keylen; /* Key length */ int rc; /* Return code */ rc = dbkexpr(ndx, &keytype, keyexpr, &keyexprlen, &keylen); if (rc == SUCCESS){ printf("\t Index file information - \n"); printf("\t \t type = '%c', keyexpression = '%s', exprlen = %d, keylen = %d \n". keytype, keyexpr, keyexprlen, keylen); } else { printf("error number %d \n", rc); exit (1); }