Dbf Files And Idx Files - Metrologic Optimus S Programming Manual

"c" programming guide
Table of Contents

Advertisement

3.14.7 DBF Files and IDX Files

DBF files and IDX files form the platform of database system. A DBF file has a fixed
record length structure. This is the file that stores data records (members). Whereas, the
associate IDX files are the files that keep information of the position of each record stored in
the DBF files, but they are re-arranged (sorted) according to some specific key values.
A library would be a good example to illustrate how DBF and IDX files work. When you
are trying to find a specific book in a library, you always start from the index. The book can
be found by looking into the index categories of book title, writer, publisher, ISBN number,
etc. All these index entries are sorted in ascending order for easy lookup according to some
specific information of books (book title, writer, publisher, ISBN number, etc.) When the
book is found in the index, it will tell you where the book is actually stored.
As you can see, the books kept in the library are analogous to the data records stored in the
DBF file, and, the various index entries are just its associate IDX files. Some information
(book title, writer, publisher, ISBN number, etc.) in the data records is used to create the
IDX files.
Key Number
Note: The valid key number ranges from 1 to 8.
Key Value
add_member
Each DBF file can have maximum 8 associate IDX files, and each of them is
identified by its key (index) number. The key number is assigned by user program
when the IDX file is created.
Data records are not fetched directly from the DBF file but rather through its
associated IDX files. The value of file pointers of the IDX files (index pointers)
does not represent the address of the data records stored in the DBF file. It indicates
the sequence number of a specific data record in the IDX file.
Purpose
To add a data record (member) to a DBF file.
Syntax
int add_member (int DBF_fd, char *member);
int DBF_fd;
char *member;
Example
add_member (DBF_fd, member);
Chapter 3 Terminal Specific Function Library
/* file handle of the target DBF file */
/* pointer to a buffer where new member is added to */
199

Advertisement

Table of Contents
loading

This manual is also suitable for:

Optimus r

Table of Contents