version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
RECNO |
|
|
2 |
!!!RECNO |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
ERRORS |
|
|
7 |
SEE ALSO |
|
|
8 |
BUGS |
|
|
9 |
---- |
|
|
10 |
!!NAME |
|
|
11 |
|
|
|
12 |
|
|
|
13 |
recno - record number database access method |
|
|
14 |
!!SYNOPSIS |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
__#include |
|
|
18 |
__ |
|
|
19 |
!!DESCRIPTION |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
The routine ''dbopen'' is the library interface to |
|
|
23 |
database files. One of the supported file formats is record |
|
|
24 |
number files. The general description of the database access |
|
|
25 |
methods is in dbopen(3), this manual page describes |
|
|
26 |
only the recno specific information. |
|
|
27 |
|
|
|
28 |
|
|
|
29 |
The record number data structure is either variable or |
|
|
30 |
fixed-length records stored in a flat-file format, accessed |
|
|
31 |
by the logical record number. The existence of record number |
|
|
32 |
five implies the existence of records one through four, and |
|
|
33 |
the deletion of record number one causes record number five |
|
|
34 |
to be renumbered to record number four, as well as the |
|
|
35 |
cursor, if positioned after record number one, to shift down |
|
|
36 |
one record. |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
The recno access method specific data structure provided to |
|
|
40 |
''dbopen'' is defined in the |
|
|
41 |
'' |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
typedef struct { |
|
|
45 |
|
|
|
46 |
|
|
|
47 |
u_long flags; |
|
|
48 |
u_int cachesize; |
|
|
49 |
u_int psize; |
|
|
50 |
int lorder; |
|
|
51 |
size_t reclen; |
|
|
52 |
u_char bval; |
|
|
53 |
char *bfname; |
|
|
54 |
|
|
|
55 |
|
|
|
56 |
} RECNOINFO; |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
The elements of this structure are defined as |
|
|
60 |
follows: |
|
|
61 |
|
|
|
62 |
|
|
|
63 |
flags |
|
|
64 |
|
|
|
65 |
|
|
|
66 |
The flag value is specified by ''or'''ing any of the |
|
|
67 |
following values: |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
R_FIXEDLEN |
|
|
71 |
|
|
|
72 |
|
|
|
73 |
The records are fixed-length, not byte delimited. The |
|
|
74 |
structure element ''reclen'' specifies the length of the |
|
|
75 |
record, and the structure element ''bval'' is used as the |
|
|
76 |
pad character. Any records, inserted into the database, that |
|
|
77 |
are less than ''reclen'' bytes long are automatically |
|
|
78 |
padded. |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
R_NOKEY |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
In the interface specified by ''dbopen'', the sequential |
|
|
85 |
record retrieval fills in both the caller's key and data |
|
|
86 |
structures. If the R_NOKEY flag is specified, the |
|
|
87 |
''cursor'' routines are not required to fill in the key |
|
|
88 |
structure. This permits applications to retrieve records at |
|
|
89 |
the end of files without reading all of the intervening |
|
|
90 |
records. |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
R_SNAPSHOT |
|
|
94 |
|
|
|
95 |
|
|
|
96 |
This flag requires that a snapshot of the file be taken when |
|
|
97 |
''dbopen'' is called, instead of permitting any |
|
|
98 |
unmodified records to be read from the original |
|
|
99 |
file. |
|
|
100 |
|
|
|
101 |
|
|
|
102 |
cachesize |
|
|
103 |
|
|
|
104 |
|
|
|
105 |
A suggested maximum size, in bytes, of the memory cache. |
|
|
106 |
This value is __only__ advisory, and the access method |
|
|
107 |
will allocate more memory rather than fail. If |
|
|
108 |
''cachesize'' is 0 (no size is specified) a default cache |
|
|
109 |
is used. |
|
|
110 |
|
|
|
111 |
|
|
|
112 |
psize |
|
|
113 |
|
|
|
114 |
|
|
|
115 |
The recno access method stores the in-memory copies of its |
|
|
116 |
records in a btree. This value is the size (in bytes) of the |
|
|
117 |
pages used for nodes in that tree. If ''psize'' is 0 (no |
|
|
118 |
page size is specified) a page size is chosen based on the |
|
|
119 |
underlying file system I/O block size. See btree(3) |
|
|
120 |
for more information. |
|
|
121 |
|
|
|
122 |
|
|
|
123 |
lorder |
|
|
124 |
|
|
|
125 |
|
|
|
126 |
The byte order for integers in the stored database metadata. |
|
|
127 |
The number should represent the order as an integer; for |
|
|
128 |
example, big endian order would be the number 4,321. If |
|
|
129 |
''lorder'' is 0 (no order is specified) the current host |
|
|
130 |
order is used. |
|
|
131 |
|
|
|
132 |
|
|
|
133 |
reclen |
|
|
134 |
|
|
|
135 |
|
|
|
136 |
The length of a fixed-length record. |
|
|
137 |
|
|
|
138 |
|
|
|
139 |
bval |
|
|
140 |
|
|
|
141 |
|
|
|
142 |
The delimiting byte to be used to mark the end of a record |
|
|
143 |
for variable-length records, and the pad character for |
|
|
144 |
fixed-length records. If no value is specified, newlines |
|
|
145 |
(``n'') are used to mark the end of variable-length records |
|
|
146 |
and fixed-length records are padded with |
|
|
147 |
spaces. |
|
|
148 |
|
|
|
149 |
|
|
|
150 |
bfname |
|
|
151 |
|
|
|
152 |
|
|
|
153 |
The recno access method stores the in-memory copies of its |
|
|
154 |
records in a btree. If bfname is non-NULL, it specifies the |
|
|
155 |
name of the btree file, as if specified as the file name for |
|
|
156 |
a dbopen of a btree file. |
|
|
157 |
|
|
|
158 |
|
|
|
159 |
The data part of the key/data pair used by the recno access |
|
|
160 |
method is the same as other access methods. The key is |
|
|
161 |
different. The ''data'' field of the key should be a |
|
|
162 |
pointer to a memory location of type ''recno_t'', as |
|
|
163 |
defined in the |
|
|
164 |
''size'' field of the key should be |
|
|
165 |
the size of that type. |
|
|
166 |
|
|
|
167 |
|
|
|
168 |
Because there can be no meta-data associated with the |
|
|
169 |
underlying recno access method files, any changes made to |
|
|
170 |
the default values (e.g. fixed record length or byte |
|
|
171 |
separator value) must be explicitly specified each time the |
|
|
172 |
file is opened. |
|
|
173 |
|
|
|
174 |
|
|
|
175 |
In the interface specified by ''dbopen'', using the |
|
|
176 |
''put'' interface to create a new record will cause the |
|
|
177 |
creation of multiple, empty records if the record number is |
|
|
178 |
more than one greater than the largest record currently in |
|
|
179 |
the database. |
|
|
180 |
!!ERRORS |
|
|
181 |
|
|
|
182 |
|
|
|
183 |
The ''recno'' access method routines may fail and set |
|
|
184 |
''errno'' for any of the errors specified for the library |
|
|
185 |
routine dbopen(3) or the following: |
|
|
186 |
|
|
|
187 |
|
|
|
188 |
[[EINVAL] |
|
|
189 |
|
|
|
190 |
|
|
|
191 |
An attempt was made to add a record to a fixed-length |
|
|
192 |
database that was too large to fit. |
|
|
193 |
!!SEE ALSO |
|
|
194 |
|
|
|
195 |
|
|
|
196 |
btree(3) dbopen(3), hash(3), |
|
|
197 |
mpool(3), |
|
|
198 |
|
|
|
199 |
|
|
|
200 |
''Document Processing in a Relational Database System'', |
|
|
201 |
Michael Stonebraker, Heidi Stettner, Joseph Kalash, Antonin |
|
|
202 |
Guttman, Nadene Lynn, Memorandum No. UCB/ERL M82/32, May |
|
|
203 |
1982. |
|
|
204 |
!!BUGS |
|
|
205 |
|
|
|
206 |
|
|
|
207 |
Only big and little endian byte order is |
|
|
208 |
supported. |
|
|
209 |
---- |