]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/recno.3
Fix redundant formatting macros
[thirdparty/man-pages.git] / man3 / recno.3
CommitLineData
fea681da
MK
1.\" Copyright (c) 1990, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)recno.3 8.5 (Berkeley) 8/18/94
33.\"
0ed55ece 34.TH RECNO 3 1994-08-18 "" "Linux Programmer's Manual"
fea681da
MK
35.UC 7
36.SH NAME
37recno \- record number database access method
38.SH SYNOPSIS
39.nf
40.ft B
41#include <sys/types.h>
42#include <db.h>
43.ft R
44.fi
45.SH DESCRIPTION
46The routine
0daa9e92 47.I dbopen
fea681da
MK
48is the library interface to database files.
49One of the supported file formats is record number files.
50The general description of the database access methods is in
31e9a9ec 51.BR dbopen (3),
fea681da
MK
52this manual page describes only the recno specific information.
53.PP
54The record number data structure is either variable or fixed-length
55records stored in a flat-file format, accessed by the logical record
56number.
57The existence of record number five implies the existence of records
58one through four, and the deletion of record number one causes
59record number five to be renumbered to record number four, as well
60as the cursor, if positioned after record number one, to shift down
61one record.
62.PP
63The recno access method specific data structure provided to
64.I dbopen
65is defined in the <db.h> include file as follows:
66.PP
b9f02710 67.nf
fea681da 68typedef struct {
b9f02710
MK
69 u_long flags;
70 u_int cachesize;
71 u_int psize;
72 int lorder;
73 size_t reclen;
74 u_char bval;
75 char *bfname;
fea681da 76} RECNOINFO;
b9f02710 77.fi
fea681da
MK
78.PP
79The elements of this structure are defined as follows:
80.TP
81flags
82The flag value is specified by
83.IR or 'ing
84any of the following values:
85.RS
86.TP
87R_FIXEDLEN
88The records are fixed-length, not byte delimited.
89The structure element
90.I reclen
91specifies the length of the record, and the structure element
92.I bval
93is used as the pad character.
94Any records, inserted into the database, that are less than
95.I reclen
96bytes long are automatically padded.
97.TP
98R_NOKEY
99In the interface specified by
100.IR dbopen ,
101the sequential record retrieval fills in both the caller's key and
102data structures.
103If the R_NOKEY flag is specified, the
104.I cursor
105routines are not required to fill in the key structure.
106This permits applications to retrieve records at the end of files without
107reading all of the intervening records.
108.TP
109R_SNAPSHOT
110This flag requires that a snapshot of the file be taken when
111.I dbopen
112is called, instead of permitting any unmodified records to be read from
113the original file.
114.RE
115.TP
116cachesize
117A suggested maximum size, in bytes, of the memory cache.
118This value is
119.B only
120advisory, and the access method will allocate more memory rather than fail.
121If
122.I cachesize
123is 0 (no size is specified) a default cache is used.
124.TP
125psize
126The recno access method stores the in-memory copies of its records
127in a btree.
128This value is the size (in bytes) of the pages used for nodes in that tree.
129If
130.I psize
131is 0 (no page size is specified) a page size is chosen based on the
132underlying file system I/O block size.
133See
31e9a9ec 134.BR btree (3)
fea681da
MK
135for more information.
136.TP
137lorder
138The byte order for integers in the stored database metadata.
139The number should represent the order as an integer; for example,
140big endian order would be the number 4,321.
141If
142.I lorder
143is 0 (no order is specified) the current host order is used.
144.TP
145reclen
146The length of a fixed-length record.
147.TP
148bval
149The delimiting byte to be used to mark the end of a record for
150variable-length records, and the pad character for fixed-length
151records.
152If no value is specified, newlines (``\en'') are used to mark the end
153of variable-length records and fixed-length records are padded with
154spaces.
155.TP
156bfname
157The recno access method stores the in-memory copies of its records
158in a btree.
159If bfname is non-NULL, it specifies the name of the btree file,
2c5f1089 160as if specified as the filename for a dbopen of a btree file.
fea681da
MK
161.PP
162The data part of the key/data pair used by the recno access method
163is the same as other access methods.
164The key is different.
165The
166.I data
167field of the key should be a pointer to a memory location of type
168.IR recno_t ,
169as defined in the <db.h> include file.
170This type is normally the largest unsigned integral type available to
171the implementation.
172The
173.I size
174field of the key should be the size of that type.
175.PP
176Because there can be no meta-data associated with the underlying
177recno access method files, any changes made to the default values
75b94dc3 178(e.g., fixed record length or byte separator value) must be explicitly
fea681da
MK
179specified each time the file is opened.
180.PP
181In the interface specified by
182.IR dbopen ,
183using the
184.I put
185interface to create a new record will cause the creation of multiple,
186empty records if the record number is more than one greater than the
187largest record currently in the database.
188.SH ERRORS
189The
190.I recno
191access method routines may fail and set
192.I errno
193for any of the errors specified for the library routine
31e9a9ec 194.BR dbopen (3)
fea681da
MK
195or the following:
196.TP
197[EINVAL]
198An attempt was made to add a record to a fixed-length database that
199was too large to fit.
e37e3282
MK
200.SH BUGS
201Only big and little endian byte order is supported.
fea681da 202.SH "SEE ALSO"
31e9a9ec
MK
203.BR btree (3)
204.BR dbopen (3),
205.BR hash (3),
d8aaa1d3 206.BR mpool (3)
fea681da
MK
207.sp
208.IR "Document Processing in a Relational Database System" ,
209Michael Stonebraker, Heidi Stettner, Joseph Kalash, Antonin Guttman,
210Nadene Lynn, Memorandum No. UCB/ERL M82/32, May 1982.