Chapter 3 Terminal Specific Function Library
207
See Also
close_DBF, create_DBF, create_index
rebuild_index
Purpose
To rebuild an IDX file for a DBF file.
Syntax
int rebuild_IDX (int DBF_fd, int key_number, int base_index, int key_offset,
int key_len);
int DBF_fd; /* file handle of the associated DBF file */
int key_number; /* key number of the IDX file to be created */
int key_base_index; /* key number of the preferred IDX file */
int key_offset; /* offset in bytes where the key value in a member begins */
int key_len; /* length of key value of the IDX file */
Example
rebuild_index (DBF_fd, 1, 0, 0, 10);
Description
This routine rebuilds or creates an IDX file (
key_number
) which is associated
with a DBF file (
DBF_fd
). The key field of the IDX file is specified by the
arguments
key_offset
and
key_len
.
This routine can be used whenever an IDX file has same key values in a
key field.
base_index
specifies the IDX file from which this routine takes
as the input sequence for building the new IDX file. For example, if a
report is to be generated by the sequence of date, department, and ID
number, and the date and department data may be repeated. This can be
done by rebuilding the ID number index first. Then rebuild the department
index with the ID number index as the base index. And finally, rebuild the
date index with the department index as the base index. The resulting
member sequence in the date index will be in date, department, and ID
number.
If no base index is preferred, the
base_index
should be 0. Then the
resulting sequence will be the original member sequence in the DBF file.
If the IDX file (
key_number
) already exists, it will be overwrittten;
otherwise, this routine will create a new IDX file.
The key field should be within
member_len
as defined in the create_DBF
function. That is,
key_offset
plus
key_len
should not be greater than
member_len.
Return
If successful, it returns 0.
On error, it returns -1.
An error code is set to the global variable fErrorCode to indicate the error
condition encountered. Below are possible error codes and their interpretation.
Error Code
Interpretation
2
File specified by
DBF_fd
does not exist.
4
File specified by
DBF_fd
is not a DBF file.
Содержание Optimus R
Страница 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Страница 6: ......
Страница 8: ...2 C Programming Guide For Optimus S R...
Страница 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Страница 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Страница 24: ...18 C Programming Guide For Optimus S R...
Страница 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...
Страница 232: ...226 C Programming Guide For Optimus S R 4 11 Implementation defined Limits limits h float h Refer to limit h and float h...
Страница 238: ...232 C Programming Guide For Optimus S R...