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