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