make the db.h HASHINFO element order match the man page
[unix-history] / usr / src / lib / libc / db / man / recno.3
CommitLineData
81b62568
KB
1.\" Copyright (c) 1990, 1993
2.\" The Regents of the University of California. All rights reserved.
f52ca292
KB
3.\"
4.\" %sccs.include.redist.man%
5.\"
81b62568 6.\" @(#)recno.3 8.1 (Berkeley) %G%
f52ca292
KB
7.\"
8.TH RECNO 3 ""
9.UC 7
10.SH NAME
11recno \- record number database access method
12.SH SYNOPSIS
13.nf
14.ft B
15#include <sys/types.h>
16#include <db.h>
17.ft R
18.fi
19.SH DESCRIPTION
20The routine
21.IR dbopen
22is the library interface to database files.
23One of the supported file formats is record number files.
24The general description of the database access methods is in
25.IR dbopen (3),
26this manual page describes only the recno specific information.
27.PP
28The record number data structure is either variable or fixed-length
0b9fa0f5
KB
29records stored in a flat-file format, accessed by the logical record
30number.
0b9fa0f5 31The existence of record number five implies the existence of records
6b34798d
KB
32one through four, and the deletion of record number one causes
33record number five to be renumbered to record number four, as well
34as the cursor, if positioned after record number one, to shift down
35one record.
f52ca292
KB
36.PP
37The recno access method specific data structure provided to
38.I dbopen
39is defined in the <db.h> include file as follows:
40.PP
41typedef struct {
42.RS
43u_char bval;
44.br
45u_int cachesize;
46.br
03998391
KB
47index_t psize;
48.br
f52ca292
KB
49u_long flags;
50.br
51int lorder;
52.br
53size_t reclen;
03998391
KB
54.br
55char *bfname;
f52ca292
KB
56.RE
57} RECNOINFO;
58.PP
59The elements of this structure are defined as follows:
60.TP
61bval
62The delimiting byte to be used to mark the end of a record for
63variable-length records, and the pad character for fixed-length
64records.
65If no value is specified, newlines (``\en'') are used to mark the end
66of variable-length records and fixed-length records are padded with
67spaces.
68.TP
69cachesize
70A suggested maximum size, in bytes, of the memory cache.
71This value is
72.B only
73advisory, and the access method will allocate more memory rather than fail.
9c15cc08
KB
74If
75.I cachesize
76is 0 (no size is specified) a default cache is used.
f52ca292 77.TP
03998391
KB
78psize
79The recno access method stores the in-memory copies of its records
80in a btree.
81This value is the size (in bytes) of the pages used for nodes in that tree.
9c15cc08
KB
82If
83.I psize
84is 0 (no page size is specified) a page size is chosen based on the
85underlying file system I/O block size.
03998391
KB
86See
87.IR btree (3)
88for more information.
89.TP
90bfname
91The recno access method stores the in-memory copies of its records
92in a btree.
93If bfname is non-NULL, it specifies the name of the btree file,
94as if specified as the file name for a dbopen of a btree file.
95.TP
f52ca292
KB
96flags
97The flag value is specified by
98.IR or 'ing
99any of the following values:
100.RS
101.TP
102R_FIXEDLEN
103The records are fixed-length, not byte delimited.
104The structure element
105.I reclen
106specifies the length of the record, and the structure element
107.I bval
108is used as the pad character.
109.TP
110R_NOKEY
111In the interface specified by
112.IR dbopen ,
113the sequential record retrieval fills in both the caller's key and
114data structures.
115If the R_NOKEY flag is specified, the
116.I cursor
117routines are not required to fill in the key structure.
118This permits applications to retrieve records at the end of files without
119reading all of the intervening records.
120.TP
121R_SNAPSHOT
122This flag requires that a snapshot of the file be taken when
123.I dbopen
124is called, instead of permitting any unmodified records to be read from
125the original file.
126.RE
127.TP
128lorder
129The byte order for integers in the stored database metadata.
130The number should represent the order as an integer; for example,
131big endian order would be the number 4,321.
132If
133.I lorder
134is 0 (no order is specified) the current host order is used.
135.TP
136reclen
137The length of a fixed-length record.
138.PP
5d926ddb
KB
139The data part of the key/data pair used by the recno access method
140is the same as other access methods.
141The key is different.
142The
143.I data
144field of the key should be a pointer to a memory location of type
145.IR recno_t ,
146as defined in the <db.h> include file.
147This type is normally the largest unsigned integral type available to
148the implementation.
149The
150.I size
151field of the key should be the size of that type.
152.PP
f52ca292
KB
153In the interface specified by
154.IR dbopen ,
155using the
156.I put
7a927673 157interface to create a new record will cause the creation of multiple,
f52ca292
KB
158empty records if the record number is more than one greater than the
159largest record currently in the database.
160.SH "SEE ALSO"
161.IR dbopen (3),
162.IR hash (3),
163.IR mpool (3),
164.IR recno (3)
5d926ddb 165.sp
f52ca292
KB
166.IR "Document Processing in a Relational Database System" ,
167Michael Stonebraker, Heidi Stettner, Joseph Kalash, Antonin Guttman,
168Nadene Lynn, Memorandum No. UCB/ERL M82/32, May 1982.
169.SH BUGS
170Only big and little endian byte order is supported.