310 lines
8.0 KiB
HTML
310 lines
8.0 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of RECNO</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>RECNO</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
recno - record number database access method
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/sys/types.h">sys/types.h</A>>
|
|
#include <<A HREF="file:///usr/include/db.h">db.h</A>>
|
|
</B></PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<I>Note well</I>:
|
|
|
|
This page documents interfaces provided in glibc up until version 2.1.
|
|
Since version 2.2, glibc no longer provides these interfaces.
|
|
Probably, you are looking for the APIs provided by the
|
|
<I>libdb</I>
|
|
|
|
library instead.
|
|
<P>
|
|
|
|
The routine
|
|
<B><A HREF="/cgi-bin/man/man2html?3+dbopen">dbopen</A></B>(3)
|
|
|
|
is the library interface to database files.
|
|
One of the supported file formats is record number files.
|
|
The general description of the database access methods is in
|
|
<B><A HREF="/cgi-bin/man/man2html?3+dbopen">dbopen</A></B>(3),
|
|
|
|
this manual page describes only the recno-specific information.
|
|
<P>
|
|
|
|
The record number data structure is either variable or fixed-length
|
|
records stored in a flat-file format, accessed by the logical record
|
|
number.
|
|
The existence of record number five implies the existence of records
|
|
one through four, and the deletion of record number one causes
|
|
record number five to be renumbered to record number four, as well
|
|
as the cursor, if positioned after record number one, to shift down
|
|
one record.
|
|
<P>
|
|
|
|
The recno access-method-specific data structure provided to
|
|
<B><A HREF="/cgi-bin/man/man2html?3+dbopen">dbopen</A></B>(3)
|
|
|
|
is defined in the
|
|
<I><<A HREF="file:///usr/include/db.h">db.h</A>></I>
|
|
|
|
include file as follows:
|
|
<P>
|
|
|
|
|
|
|
|
typedef struct {
|
|
<BR> unsigned long flags;
|
|
<BR> unsigned int cachesize;
|
|
<BR> unsigned int psize;
|
|
<BR> int lorder;
|
|
<BR> size_t reclen;
|
|
<BR> unsigned char bval;
|
|
<BR> char *bfname;
|
|
} RECNOINFO;
|
|
|
|
|
|
<P>
|
|
|
|
The elements of this structure are defined as follows:
|
|
<DL COMPACT>
|
|
<DT id="1"><I>flags</I>
|
|
|
|
<DD>
|
|
The flag value is specified by ORing
|
|
any of the following values:
|
|
<DL COMPACT><DT id="2"><DD>
|
|
<DL COMPACT>
|
|
<DT id="3"><B>R_FIXEDLEN</B>
|
|
|
|
<DD>
|
|
The records are fixed-length, not byte delimited.
|
|
The structure element
|
|
<I>reclen</I>
|
|
|
|
specifies the length of the record, and the structure element
|
|
<I>bval</I>
|
|
|
|
is used as the pad character.
|
|
Any records, inserted into the database, that are less than
|
|
<I>reclen</I>
|
|
|
|
bytes long are automatically padded.
|
|
<DT id="4"><B>R_NOKEY</B>
|
|
|
|
<DD>
|
|
In the interface specified by
|
|
<B><A HREF="/cgi-bin/man/man2html?3+dbopen">dbopen</A></B>(3),
|
|
|
|
the sequential record retrieval fills in both the caller's key and
|
|
data structures.
|
|
If the
|
|
<B>R_NOKEY</B>
|
|
|
|
flag is specified, the
|
|
<I>cursor</I>
|
|
|
|
routines are not required to fill in the key structure.
|
|
This permits applications to retrieve records at the end of files without
|
|
reading all of the intervening records.
|
|
<DT id="5"><B>R_SNAPSHOT</B>
|
|
|
|
<DD>
|
|
This flag requires that a snapshot of the file be taken when
|
|
<B><A HREF="/cgi-bin/man/man2html?3+dbopen">dbopen</A></B>(3)
|
|
|
|
is called, instead of permitting any unmodified records to be read from
|
|
the original file.
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="6"><I>cachesize</I>
|
|
|
|
<DD>
|
|
A suggested maximum size, in bytes, of the memory cache.
|
|
This value is
|
|
<B>only</B>
|
|
|
|
advisory, and the access method will allocate more memory rather than fail.
|
|
If
|
|
<I>cachesize</I>
|
|
|
|
is 0 (no size is specified), a default cache is used.
|
|
<DT id="7"><I>psize</I>
|
|
|
|
<DD>
|
|
The recno access method stores the in-memory copies of its records
|
|
in a btree.
|
|
This value is the size (in bytes) of the pages used for nodes in that tree.
|
|
If
|
|
<I>psize</I>
|
|
|
|
is 0 (no page size is specified), a page size is chosen based on the
|
|
underlying filesystem I/O block size.
|
|
See
|
|
<B><A HREF="/cgi-bin/man/man2html?3+btree">btree</A></B>(3)
|
|
|
|
for more information.
|
|
<DT id="8"><I>lorder</I>
|
|
|
|
<DD>
|
|
The byte order for integers in the stored database metadata.
|
|
The number should represent the order as an integer; for example,
|
|
big endian order would be the number 4,321.
|
|
If
|
|
<I>lorder</I>
|
|
|
|
is 0 (no order is specified), the current host order is used.
|
|
<DT id="9"><I>reclen</I>
|
|
|
|
<DD>
|
|
The length of a fixed-length record.
|
|
<DT id="10"><I>bval</I>
|
|
|
|
<DD>
|
|
The delimiting byte to be used to mark the end of a record for
|
|
variable-length records, and the pad character for fixed-length
|
|
records.
|
|
If no value is specified, newlines ("\n") are used to mark the end
|
|
of variable-length records and fixed-length records are padded with
|
|
spaces.
|
|
<DT id="11"><I>bfname</I>
|
|
|
|
<DD>
|
|
The recno access method stores the in-memory copies of its records
|
|
in a btree.
|
|
If
|
|
<I>bfname</I>
|
|
|
|
is non-NULL, it specifies the name of the btree file,
|
|
as if specified as the filename for a
|
|
<B><A HREF="/cgi-bin/man/man2html?3+dbopen">dbopen</A></B>(3)
|
|
|
|
of a btree file.
|
|
</DL>
|
|
<P>
|
|
|
|
The data part of the key/data pair used by the
|
|
<I>recno</I>
|
|
|
|
access method
|
|
is the same as other access methods.
|
|
The key is different.
|
|
The
|
|
<I>data</I>
|
|
|
|
field of the key should be a pointer to a memory location of type
|
|
<I>recno_t</I>,
|
|
|
|
as defined in the
|
|
<I><<A HREF="file:///usr/include/db.h">db.h</A>></I>
|
|
|
|
include file.
|
|
This type is normally the largest unsigned integral type available to
|
|
the implementation.
|
|
The
|
|
<I>size</I>
|
|
|
|
field of the key should be the size of that type.
|
|
<P>
|
|
|
|
Because there can be no metadata associated with the underlying
|
|
recno access method files, any changes made to the default values
|
|
(e.g., fixed record length or byte separator value) must be explicitly
|
|
specified each time the file is opened.
|
|
<P>
|
|
|
|
In the interface specified by
|
|
<B><A HREF="/cgi-bin/man/man2html?3+dbopen">dbopen</A></B>(3),
|
|
|
|
using the
|
|
<I>put</I>
|
|
|
|
interface to create a new record will cause the creation of multiple,
|
|
empty records if the record number is more than one greater than the
|
|
largest record currently in the database.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
The
|
|
<I>recno</I>
|
|
|
|
access method routines may fail and set
|
|
<I>errno</I>
|
|
|
|
for any of the errors specified for the library routine
|
|
<B><A HREF="/cgi-bin/man/man2html?3+dbopen">dbopen</A></B>(3)
|
|
|
|
or the following:
|
|
<DL COMPACT>
|
|
<DT id="12"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
An attempt was made to add a record to a fixed-length database that
|
|
was too large to fit.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
Only big and little endian byte order is supported.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+btree">btree</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+dbopen">dbopen</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+hash">hash</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+mpool">mpool</A></B>(3)
|
|
|
|
<P>
|
|
|
|
<I>Document Processing in a Relational Database System</I>,
|
|
|
|
Michael Stonebraker, Heidi Stettner, Joseph Kalash, Antonin Guttman,
|
|
Nadene Lynn, Memorandum No. UCB/ERL M82/32, May 1982.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="13"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="14"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="15"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="16"><A HREF="#lbAE">ERRORS</A><DD>
|
|
<DT id="17"><A HREF="#lbAF">BUGS</A><DD>
|
|
<DT id="18"><A HREF="#lbAG">SEE ALSO</A><DD>
|
|
<DT id="19"><A HREF="#lbAH">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:54 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|