source: trunk/src/emx/bsd/db/man/recno.3@ 978

Last change on this file since 978 was 272, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 6.8 KB
Line 
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.\"
34.TH RECNO 3 "August 18, 1994"
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
47.IR dbopen
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
51.IR dbopen (3),
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
67typedef struct {
68.RS
69u_long flags;
70.br
71u_int cachesize;
72.br
73u_int psize;
74.br
75int lorder;
76.br
77size_t reclen;
78.br
79u_char bval;
80.br
81char *bfname;
82.RE
83} RECNOINFO;
84.PP
85The elements of this structure are defined as follows:
86.TP
87flags
88The flag value is specified by
89.IR or 'ing
90any of the following values:
91.RS
92.TP
93R_FIXEDLEN
94The records are fixed-length, not byte delimited.
95The structure element
96.I reclen
97specifies the length of the record, and the structure element
98.I bval
99is used as the pad character.
100Any records, inserted into the database, that are less than
101.I reclen
102bytes long are automatically padded.
103.TP
104R_NOKEY
105In the interface specified by
106.IR dbopen ,
107the sequential record retrieval fills in both the caller's key and
108data structures.
109If the R_NOKEY flag is specified, the
110.I cursor
111routines are not required to fill in the key structure.
112This permits applications to retrieve records at the end of files without
113reading all of the intervening records.
114.TP
115R_SNAPSHOT
116This flag requires that a snapshot of the file be taken when
117.I dbopen
118is called, instead of permitting any unmodified records to be read from
119the original file.
120.RE
121.TP
122cachesize
123A suggested maximum size, in bytes, of the memory cache.
124This value is
125.B only
126advisory, and the access method will allocate more memory rather than fail.
127If
128.I cachesize
129is 0 (no size is specified) a default cache is used.
130.TP
131psize
132The recno access method stores the in-memory copies of its records
133in a btree.
134This value is the size (in bytes) of the pages used for nodes in that tree.
135If
136.I psize
137is 0 (no page size is specified) a page size is chosen based on the
138underlying file system I/O block size.
139See
140.IR btree (3)
141for more information.
142.TP
143lorder
144The byte order for integers in the stored database metadata.
145The number should represent the order as an integer; for example,
146big endian order would be the number 4,321.
147If
148.I lorder
149is 0 (no order is specified) the current host order is used.
150.TP
151reclen
152The length of a fixed-length record.
153.TP
154bval
155The delimiting byte to be used to mark the end of a record for
156variable-length records, and the pad character for fixed-length
157records.
158If no value is specified, newlines (``\en'') are used to mark the end
159of variable-length records and fixed-length records are padded with
160spaces.
161.TP
162bfname
163The recno access method stores the in-memory copies of its records
164in a btree.
165If bfname is non-NULL, it specifies the name of the btree file,
166as if specified as the file name for a dbopen of a btree file.
167.PP
168The data part of the key/data pair used by the recno access method
169is the same as other access methods.
170The key is different.
171The
172.I data
173field of the key should be a pointer to a memory location of type
174.IR recno_t ,
175as defined in the <db.h> include file.
176This type is normally the largest unsigned integral type available to
177the implementation.
178The
179.I size
180field of the key should be the size of that type.
181.PP
182Because there can be no meta-data associated with the underlying
183recno access method files, any changes made to the default values
184(e.g. fixed record length or byte separator value) must be explicitly
185specified each time the file is opened.
186.PP
187In the interface specified by
188.IR dbopen ,
189using the
190.I put
191interface to create a new record will cause the creation of multiple,
192empty records if the record number is more than one greater than the
193largest record currently in the database.
194.SH ERRORS
195The
196.I recno
197access method routines may fail and set
198.I errno
199for any of the errors specified for the library routine
200.IR dbopen (3)
201or the following:
202.TP
203[EINVAL]
204An attempt was made to add a record to a fixed-length database that
205was too large to fit.
206.SH "SEE ALSO"
207.IR btree (3)
208.IR dbopen (3),
209.IR hash (3),
210.IR mpool (3),
211.sp
212.IR "Document Processing in a Relational Database System" ,
213Michael Stonebraker, Heidi Stettner, Joseph Kalash, Antonin Guttman,
214Nadene Lynn, Memorandum No. UCB/ERL M82/32, May 1982.
215.SH BUGS
216Only big and little endian byte order is supported.
Note: See TracBrowser for help on using the repository browser.