OSDN Git Service

(split) Apply minor changes from v3.32 to v3.35 in the upstream.
[linuxjm/LDP_man-pages.git] / draft / man3 / dbopen.3
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 .\"     @(#)dbopen.3    8.5 (Berkeley) 1/2/94
33 .\"
34 .\" Japanese Version Copyright (c) 1999 Shouichi Saito
35 .\"     all rights reserved.
36 .\" Translated Thu Jul 22 00:00:00 JST 1999
37 .\"     by Shouichi Saito <ss236rx@ymg.urban.ne.jp>
38 .\" Proofed Tue Aug 19 1999 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
39 .\"
40 .\"WORD:        descriptor      ¥Ç¥¹¥¯¥ê¥×¥¿
41 .TH DBOPEN 3 1994-01-02 "" "Linux Programmer's Manual"
42 .UC 7
43 .\"O .SH NAME
44 .SH Ì¾Á°
45 .\"O dbopen \- database access methods
46 dbopen \- ¥Ç¡¼¥¿¥Ù¡¼¥¹¥¢¥¯¥»¥¹¥á¥½¥Ã¥É
47 .\"O .SH SYNOPSIS
48 .SH ½ñ¼°
49 .nf
50 .B #include <sys/types.h>
51 .B #include <limits.h>
52 .B #include <db.h>
53
54 .BI "DB *dbopen(const char *" file ", int " flags ", int " mode \
55 ", DBTYPE " type ,
56 .BI "           const void *" openinfo );
57 .fi
58 .\"O .SH DESCRIPTION
59 .SH ÀâÌÀ
60 .\"O .BR dbopen ()
61 .\"O is the library interface to database files.
62 .BR dbopen ()
63 ¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ë¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ç¤¢¤ë¡£
64 .\"O The supported file formats are btree, hashed and UNIX file oriented.
65 .\"O The btree format is a representation of a sorted, balanced tree structure.
66 .\"O The hashed format is an extensible, dynamic hashing scheme.
67 .\"O The flat-file format is a byte stream file with fixed or variable length
68 .\"O records.
69 ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï btree, hash,
70 UNIX ¥Õ¥¡¥¤¥ë¤Ë»Ø¸þ¤·¤¿¥Õ¥©¡¼¥Þ¥Ã¥È, ¤Î 3 ¤Ä¤Ç¤¢¤ë¡£
71 btree ¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï¡¢¥½¡¼¥È¤µ¤ì¤¿¥Ð¥é¥ó¥¹¥Ä¥ê¡¼¹½Â¤¤Ç¤¢¤ë¡£
72 hashed ¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï¡¢³ÈÄ¥²Äǽ¤ÊưŪ hash ¥¹¥­¡¼¥à¤Ç¤¢¤ë¡£
73 ¥Õ¥é¥Ã¥È¥Õ¥¡¥¤¥ë (flat-file) ¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï¡¢
74 ¸ÇÄêĹ/²ÄÊÑĹ¤Î¥ì¥³¡¼¥É¤«¤é¤Ê¤ë¥Ð¥¤¥È¥¹¥È¥ê¡¼¥à¥Õ¥¡¥¤¥ë¤Ç¤¢¤ë¡£
75 .\"O The formats and file format specific information are described in detail
76 .\"O in their respective manual pages
77 .\"O .BR btree (3),
78 .\"O .BR hash (3)
79 .\"O and
80 .\"O .BR recno (3).
81 ¤½¤ì¤¾¤ì¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤È¡¢¥Õ¥¡¥¤¥ë¥Õ¥©¡¼¥Þ¥Ã¥È¤ËÆÃÍ­¤Î¾ðÊó¤Ï
82 ¤½¤ì¤¾¤ìÂбþ¤¹¤ë¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸
83 .BR btree (3),
84 .BR hash (3),
85 .BR recno (3)
86 ¤Ë¾ÜºÙ¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ë¡£
87 .PP
88 .\"O .BR dbopen ()
89 .\"O opens
90 .\"O .I file
91 .\"O for reading and/or writing.
92 .BR dbopen ()
93 ¤Ï
94 .I file
95 ¤òÆɤ߹þ¤ß (Æɤ߽ñ¤­) ¤¹¤ë¤¿¤á¤Ë¥ª¡¼¥×¥ó¤¹¤ë¡£
96 .\"O Files never intended to be preserved on disk may be created by setting
97 .\"O the
98 .\"O .I file
99 .\"O argument to NULL.
100 .I file
101 °ú¤­¿ô¤ò NULL ¤Ë¤¹¤ì¤Ð¡¢
102 ¥Ç¥£¥¹¥¯¾å¤ËÊݸ¤·¤¿¤¯¤Ê¤¤¥Õ¥¡¥¤¥ë¤òºî¤ë¤³¤È¤â¤Ç¤­¤ë¡£
103 .PP
104 .\"O The
105 .\"O .I flags
106 .\"O and
107 .\"O .I mode
108 .\"O arguments are as specified to the
109 .\"O .BR open (2)
110 .\"O routine, however, only the
111 .\"O .BR O_CREAT ,
112 .\"O .BR O_EXCL ,
113 .\"O .BR O_EXLOCK ,
114 .\"O .BR O_NONBLOCK ,
115 .\"O .BR O_RDONLY ,
116 .\"O .BR O_RDWR ,
117 .\"O .BR O_SHLOCK ,
118 .\"O and
119 .\"O .B O_TRUNC
120 .\"O flags are meaningful.
121 .I flags
122 ¤È
123 .I mode
124 °ú¤­¿ô¤Ï
125 .BR open (2)
126 ¥ë¡¼¥Á¥ó¤Ç»ØÄꤹ¤ë¤Î¤ÈƱÍͤǤ¢¤ë¡£¤¿¤À¤·
127 °ÕÌ£¤ò»ý¤Ä¥Õ¥é¥°¤Ï
128 .BR O_CREAT ,
129 .BR O_EXCL ,
130 .BR O_EXLOCK ,
131 .BR O_NONBLOCK ,
132 .BR O_RDONLY ,
133 .BR O_RDWR ,
134 .BR O_SHLOCK ,
135 .B O_TRUNC
136 ¤À¤±¤Ç¤¢¤ë¡£
137 .\"O (Note, opening a database file
138 .\"O .B O_WRONLY
139 .\"O is not possible.)
140 (Ãí°Õ:
141 .B O_WRONLY
142 ¤Ç¥Ç¡¼¥¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë¤ò³«¤¯»ö¤Ï½ÐÍè¤Ê¤¤)
143 .\"Three additional options may be specified by ORing
144 .\"them into the
145 .\".I flags
146 .\"argument.
147 .\".TP
148 .\"DB_LOCK
149 .\"Do the necessary locking in the database to support concurrent access.
150 .\"If concurrent access isn't needed or the database is read-only this
151 .\"flag should not be set, as it tends to have an associated performance
152 .\"penalty.
153 .\".TP
154 .\"DB_SHMEM
155 .\"Place the underlying memory pool used by the database in shared
156 .\"memory.
157 .\"Necessary for concurrent access.
158 .\".TP
159 .\"DB_TXN
160 .\"Support transactions in the database.
161 .\"The DB_LOCK and DB_SHMEM flags must be set as well.
162 .PP
163 .\"O The
164 .\"O .I type
165 .\"O argument is of type
166 .\"O .I DBTYPE
167 .\"O (as defined in the
168 .\"O .I <db.h>
169 .\"O include file) and
170 .\"O may be set to
171 .\"O .BR DB_BTREE ,
172 .\"O .BR DB_HASH ,
173 .\"O or
174 .\"O .BR DB_RECNO .
175 .I type
176 °ú¤­¿ô¤Ï
177 .I DBTYPE
178 ·¿¤Ç¤¢¤ë (¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë
179 .I <db.h>
180 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë)¡£
181 .BR DB_BTREE ,
182 .BR DB_HASH ,
183 .B DB_RECNO
184 ¤Î¤¤¤º¤ì¤«¤ò¥»¥Ã¥È¤Ç¤­¤ë¡£
185 .PP
186 .\"O The
187 .\"O .I openinfo
188 .\"O argument is a pointer to an access method specific structure described
189 .\"O in the access method's manual page.
190 .\"O If
191 .\"O .I openinfo
192 .\"O is NULL, each access method will use defaults appropriate for the system
193 .\"O and the access method.
194 .I openinfo
195 °ú¤­¿ô¤Ï¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ë¸ÇÍ­¤Ê¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤Ç¤¢¤ë¡£
196 ¤½¤ì¤¾¤ì¤Î¹½Â¤ÂΤ˴ؤ·¤Æ¤Ï³Æ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Î
197 ¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ë¡£
198 .I openinfo
199 ¤¬ NULL ¤Î¾ì¹ç¡¢¤½¤ì¤¾¤ì¤Î¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤È¥·¥¹¥Æ¥à¤È¤ËŬ¹ç¤·¤¿
200 ¥Ç¥Õ¥©¥ë¥È¤¬ÍѤ¤¤é¤ì¤ë¡£
201 .PP
202 .\"O .BR dbopen ()
203 .\"O returns a pointer to a
204 .\"O .I DB
205 .\"O structure on success and NULL on error.
206 .\"O The
207 .\"O .I DB
208 .\"O structure is defined in the
209 .\"O .I <db.h>
210 .\"O include file, and contains at
211 .\"O least the following fields:
212 .BR dbopen ()
213 ¤Ï¡¢À®¸ù¤·¤¿¾ì¹ç
214 .I DB
215 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤ò¡¢¥¨¥é¡¼¤Î¾ì¹ç NULL ¤òÊÖ¤¹¡£
216 .I DB
217 ¹½Â¤ÂΤÏ
218 .I <db.h>
219 ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤ÎÃæ¤ÇÄêµÁ¤µ¤ì¤Æ¤ª¤ê¡¢
220 ¾¯¤Ê¤¯¤È¤â°Ê²¼¤Î¤è¤¦¤Ê¥Õ¥£¡¼¥ë¥É¤ò»ý¤Ã¤Æ¤¤¤ë¡£
221 .sp
222 .in +4n
223 .nf
224 typedef struct {
225     DBTYPE type;
226     int (*close)(const DB *db);
227     int (*del)(const DB *db, const DBT *key, unsigned int flags);
228     int (*fd)(const DB *db);
229     int (*get)(const DB *db, DBT *key, DBT *data,
230                unsigned int flags);
231     int (*put)(const DB *db, DBT *key, const DBT *data,
232                unsigned int flags);
233     int (*sync)(const DB *db, unsigned int flags);
234     int (*seq)(const DB *db, DBT *key, DBT *data,
235                unsigned int flags);
236 } DB;
237 .fi
238 .in
239 .PP
240 .\"O These elements describe a database type and a set of functions performing
241 .\"O various actions.
242 .\"O These functions take a pointer to a structure as returned by
243 .\"O .BR dbopen (),
244 .\"O and sometimes one or more pointers to key/data structures and a flag value.
245 ³ÆÍ×ÁǤˤϡ¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥¿¥¤¥×¤È¡¢
246 ÍÍ¡¹¤ÊÆ°ºî¤ò¤¹¤ë´Ø¿ô¤Î¥»¥Ã¥È¤¬µ­½Ò¤µ¤ì¤Æ¤¤¤ë¡£
247 ¤³¤ì¤é¤Î´Ø¿ô¤Ï
248 .BR dbopen ()
249 ¤Ë¤è¤Ã¤ÆÊÖ¤µ¤ì¤ë¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤ò°ú¤­¿ô¤Ë¤È¤ë¡£
250 ¥­¡¼/¥Ç¡¼¥¿¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤ä¥Õ¥é¥°Ãͤò¼è¤ë¤â¤Î¤â¤¢¤ë¡£
251 .TP
252 .I type
253 .\"O The type of the underlying access method (and file format).
254 ÍѤ¤¤é¤ì¤Æ¤¤¤ë¥¢¥¯¥»¥¹¥á¥½¥Ã¥É (¤È¥Õ¥¡¥¤¥ë¥Õ¥©¡¼¥Þ¥Ã¥È) ¤Î·¿¡£
255 .TP
256 .I close
257 .\"O A pointer to a routine to flush any cached information to disk, free any
258 .\"O allocated resources, and close the underlying file(s).
259 ¥­¥ã¥Ã¥·¥å¤µ¤ì¤¿¾ðÊó¤ò¥Ç¥£¥¹¥¯¤ËÁݤ­¤À¤¹¤¿¤á¤Î¥ë¡¼¥Á¥ó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
260 ³ä¤êÅö¤Æ¤é¤ì¤¿¥ê¥½¡¼¥¹¤ò²òÊü¤·¡¢ÍøÍѤ·¤¿¥Õ¥¡¥¤¥ë(·²)¤ò¥¯¥í¡¼¥º¤¹¤ë¡£
261 .\"O Since key/data pairs may be cached in memory, failing to sync the file
262 .\"O with a
263 .\"O .I close
264 .\"O or
265 .\"O .I sync
266 .\"O function may result in inconsistent or lost information.
267 ¥­¡¼/¥Ç¡¼¥¿ÂФ¬¥á¥â¥ê¤Ë¥­¥ã¥Ã¥·¥å¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
268 .I close
269 ¤ä
270 .I sync
271 ´Ø¿ô¤Ç¤ÎƱ´ü¤Ë¼ºÇÔ¤¹¤ë¤È¡¢¾ðÊó¤ËÌ·½â¤¬À¸¤¸¤ë¤«¾ðÊó¤ò¼º¤¦²ÄǽÀ­¤¬¤¢¤ë¡£
272 .\"O .I close
273 .\"O routines return \-1 on error (setting
274 .\"O .IR errno )
275 .\"O and 0 on success.
276 .I close
277 ¥ë¡¼¥Á¥ó¤Ï¥¨¥é¡¼¤Î¾ì¹ç \-1 ¤òÊÖ¤·
278 .RI ( errno
279 ¤ò¥»¥Ã¥È¤¹¤ë)¡¢À®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£
280 .TP
281 .I del
282 .\"O A pointer to a routine to remove key/data pairs from the database.
283 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¥­¡¼/¥Ç¡¼¥¿ÂФòºï½ü¤¹¤ë¥ë¡¼¥Á¥ó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
284 .IP
285 .\"O The argument
286 .\"O .I flag
287 .\"O may be set to the following value:
288 .I flag
289 °ú¤­¿ô¤Ï¼¡¤ÎÃͤ¬¥»¥Ã¥È¤Ç¤­¤ë¡£
290 .RS
291 .TP
292 .B R_CURSOR
293 .\"O Delete the record referenced by the cursor.
294 .\"O The cursor must have previously been initialized.
295 ¥«¡¼¥½¥ë (cursor) ¤¬»²¾È¤·¤Æ¤¤¤ë¥ì¥³¡¼¥É¤òºï½ü¤¹¤ë¡£
296 ¥«¡¼¥½¥ë¤ÏÁ°¤â¤Ã¤Æ½é´ü²½¤µ¤ì¤Æ¤¤¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
297 .RE
298 .IP
299 .\"O .I delete
300 .\"O routines return \-1 on error (setting
301 .\"O .IR errno ),
302 .\"O 0 on success, and 1 if the specified
303 .\"O .I key
304 .\"O was not in the file.
305 .I delete
306 ¥ë¡¼¥Á¥ó¤Ï¥¨¥é¡¼¤Î¾ì¹ç \-1 ¤òÊÖ¤·
307 .RI ( errno
308 ¤ò¥»¥Ã¥È¤¹¤ë)¡¢À®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£¤Þ¤¿»ØÄê¤Î
309 .I key
310 ¤¬¥Õ¥¡¥¤¥ëÃæ¤Ë̵¤¤¾ì¹ç 1 ¤òÊÖ¤¹¡£
311 .TP
312 .I fd
313 .\"O A pointer to a routine which returns a file descriptor representative
314 .\"O of the underlying database.
315 ÍѤ¤¤Æ¤¤¤ë¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤òÊÖ¤¹¥ë¡¼¥Á¥ó
316 ¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
317 .\"O A file descriptor referencing the same file will be returned to all
318 .\"O processes which call
319 .\"O .BR dbopen ()
320 .\"O with the same
321 .\"O .I file
322 .\"O name.
323 Ʊ¤¸¥Õ¥¡¥¤¥ë̾
324 .I file
325 ¤Ç
326 .BR dbopen ()
327 ¤ò¸Æ¤Ó½Ð¤·¤¿Á´¤Æ¤Î¥×¥í¥»¥¹¤ËÂФ·¤Æ¡¢
328 ¤½¤Î¥Õ¥¡¥¤¥ë¤ò¼¨¤¹Ã±°ì¤Î¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤¬ÊÖ¤µ¤ì¤ë¡£
329 .\"O This file descriptor may be safely used as an argument to the
330 .\"O .BR fcntl (2)
331 .\"O and
332 .\"O .BR flock (2)
333 .\"O locking functions.
334 ¤³¤Î¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤Ï¥í¥Ã¥¯´Ø¿ô
335 .BR fcntl (2)
336 ¤È
337 .BR flock (2)
338 ¤Ø¤Î°ú¤­¿ô¤È¤·¤Æ°ÂÁ´¤Ë»ÈÍѤǤ­¤ë¡£
339 .\"O The file descriptor is not necessarily associated with any of the
340 .\"O underlying files used by the access method.
341 .\"O No file descriptor is available for in memory databases.
342 .\"O .I fd
343 .\"O routines return \-1 on error (setting
344 .\"O .IR errno ),
345 .\"O and the file descriptor on success.
346 ¤³¤Î¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤Ï¡¢É¬¤º¤·¤â¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ç
347 ÍѤ¤¤é¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤Î¤¤¤º¤ì¤«¤Ë´ØÏ¢¤Å¤±¤é¤ì¤Æ¤¤¤Ê¤¯¤Æ¤âÎɤ¤¡£
348 ¥á¥â¥êÆâ¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¤Ï¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤Ï̵¤¤¡£
349 .I fd
350 ¥ë¡¼¥Á¥ó¤Ï¥¨¥é¡¼¤Î¾ì¹ç \-1 ¤òÊÖ¤·
351 .RI ( errno
352 ¤ò¥»¥Ã¥È¤¹¤ë)¡¢À®¸ù¤¹¤ë¤È¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤òÊÖ¤¹¡£
353 .TP
354 .I get
355 .\"O A pointer to a routine which is the interface for keyed retrieval from
356 .\"O the database.
357 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¥­¡¼¤òÍѤ¤¤Æ¥Ç¡¼¥¿¤ò¼è¤ê½Ð¤¹¤¿¤á¤Î
358 ¥ë¡¼¥Á¥ó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
359 .\"O The address and length of the data associated with the specified
360 .\"O .I key
361 .\"O are returned in the structure referenced by
362 .\"O .IR data .
363 »ØÄꤷ¤¿
364 .I key
365 ¤Ë´ØÏ¢¤Å¤±¤é¤ì¤¿¥Ç¡¼¥¿¤Î¥¢¥É¥ì¥¹¤ÈŤµ¤¬
366 .I data
367 ¤¬»²¾È¤¹¤ë¹½Â¤ÂΤËÊÖ¤µ¤ì¤ë¡£
368 .\"O .I get
369 .\"O routines return \-1 on error (setting
370 .\"O .IR errno ),
371 .\"O 0 on success, and 1 if the
372 .\"O .I key
373 .\"O was not in the file.
374 .I get
375 ¥ë¡¼¥Á¥ó¤Ï¥¨¥é¡¼¤Î¾ì¹ç \-1 ¤òÊÖ¤·
376 .RI ( errno
377 ¤ò¥»¥Ã¥È¤¹¤ë)¡¢À®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£¤Þ¤¿
378 .I key
379 ¤¬¥Õ¥¡¥¤¥ëÃæ¤Ë̵¤¤¾ì¹ç 1 ¤òÊÖ¤¹¡£
380 .TP
381 .I put
382 .\"O A pointer to a routine to store key/data pairs in the database.
383 ¥­¡¼/¥Ç¡¼¥¿ÂФò¥Ç¡¼¥¿¥Ù¡¼¥¹¤ËǼ¤á¤ë¥ë¡¼¥Á¥ó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
384 .IP
385 .\"O The argument
386 .\"O .I flag
387 .\"O may be set to one of the following values:
388 .I flag
389 °ú¤­¿ô¤Ë¤Ï¼¡¤ÎÃͤΤ¦¤Á¤Î¤É¤ì¤«°ì¤Ä¤¬¥»¥Ã¥È¤Ç¤­¤ë¡£
390 .RS
391 .TP
392 .B R_CURSOR
393 .\"O Replace the key/data pair referenced by the cursor.
394 .\"O The cursor must have previously been initialized.
395 ¥«¡¼¥½¥ë¤¬»²¾È¤·¤Æ¤¤¤ë¥­¡¼/¥Ç¡¼¥¿ÂФòÃÖ¤­´¹¤¨¤ë¡£
396 ¥«¡¼¥½¥ë¤ÏÁ°¤â¤Ã¤Æ½é´ü²½¤µ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
397 .TP
398 .B R_IAFTER
399 .\"O Append the data immediately after the data referenced by
400 .\"O .IR key ,
401 .\"O creating a new key/data pair.
402 .\"O The record number of the appended key/data pair is returned in the
403 .\"O .I key
404 .\"O structure.
405 .\"O (Applicable only to the
406 .\"O .B DB_RECNO
407 .\"O access method.)
408 .I key
409 ¤Ç»²¾È¤µ¤ì¤ë¥Ç¡¼¥¿¤Îľ¸å¤Ë¡¢
410 ¿·¤·¤¤¥­¡¼/¥Ç¡¼¥¿ÂФòºî¤Ã¤Æ¥Ç¡¼¥¿¤òÄɲ乤롣
411 Äɲ䵤줿¥­¡¼/¥Ç¡¼¥¿ÂФΥ쥳¡¼¥ÉÈÖ¹æ¤Ï
412 .I key
413 ¹½Â¤ÂΤËÊÖ¤µ¤ì¤ë¡£
414 .RB ( DB_RECNO
415 ¥¢¥¯¥»¥¹ÊýË¡¤Ç¤Î¤ß»È¤¨¤ë¡£)
416 .TP
417 .B R_IBEFORE
418 .\"O Insert the data immediately before the data referenced by
419 .\"O .IR key ,
420 .\"O creating a new key/data pair.
421 .\"O The record number of the inserted key/data pair is returned in the
422 .\"O .I key
423 .\"O structure.
424 .\"O (Applicable only to the
425 .\"O .B DB_RECNO
426 .\"O access method.)
427 .I key
428 ¤Ç»²¾È¤µ¤ì¤ë¥Ç¡¼¥¿¤ÎľÁ°¤Ë¡¢
429 ¿·¤·¤¤¥­¡¼/¥Ç¡¼¥¿ÂФòºî¤Ã¤Æ¥Ç¡¼¥¿¤òÁÞÆþ¤¹¤ë¡£
430 Äɲ䵤줿¥­¡¼/¥Ç¡¼¥¿ÂФΥ쥳¡¼¥ÉÈÖ¹æ¤Ï
431 .I key
432 ¹½Â¤ÂΤËÊÖ¤µ¤ì¤ë¡£
433 .RB ( DB_RECNO
434 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ç¤Î¤ß»È¤¨¤ë¡£)
435 .TP
436 .B R_NOOVERWRITE
437 .\"O Enter the new key/data pair only if the key does not previously exist.
438 ¥­¡¼¤¬¤¢¤é¤«¤¸¤á¸ºß¤·¤Ê¤¤¾ì¹ç¤Ë¸Â¤ê¡¢¿·¤·¤¤¥­¡¼/¥Ç¡¼¥¿ÂФò¤¤¤ì¤ë¡£
439 .TP
440 .B R_SETCURSOR
441 .\"O Store the key/data pair, setting or initializing the position of the
442 .\"O cursor to reference it.
443 .\"O (Applicable only to the
444 .\"O .B DB_BTREE
445 .\"O and
446 .\"O .B DB_RECNO
447 .\"O access methods.)
448 ¥­¡¼/¥Ç¡¼¥¿ÂФòǼ¤á¡¢¤½¤ì¤ò»Ø¤¹¤è¤¦¤Ë¥«¡¼¥½¥ë°ÌÃÖ¤ò¥»¥Ã¥È¤¢¤ë¤¤¤Ï½é´ü
449 ²½¤¹¤ë¡£
450 .RB ( DB_BTREE
451 ¤È
452 .B DB_RECNO
453 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ç¤Î¤ß»È¤¨¤ë¡£)
454 .RE
455 .IP
456 .\"O .B R_SETCURSOR
457 .\"O is available only for the
458 .\"O .B DB_BTREE
459 .\"O and
460 .\"O .B DB_RECNO
461 .\"O access
462 .\"O methods because it implies that the keys have an inherent order
463 .\"O which does not change.
464 .B R_SETCURSOR
465 ¤Ï
466 .B DB_BTREE
467 ¤È
468 .B DB_RECNO
469 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ç¤·¤«ÍøÍѤǤ­¤Ê¤¤¡£
470 ¤Ê¤¼¤Ê¤é
471 .B R_SETCURSOR
472 ¤òÍѤ¤¤ë¤Ë¤Ï¡¢Êѹ¹¤µ¤ì¤ë»ö¤Î̵¤¤¸ÇÍ­¤Î½ç½ø¤ò¥­¡¼
473 ¤¬»ý¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£
474 .IP
475 .\"O .B R_IAFTER
476 .\"O and
477 .\"O .B R_IBEFORE
478 .\"O are available only for the
479 .\"O .B DB_RECNO
480 .\"O access method because they each imply that the access method is able to
481 .\"O create new keys.
482 .\"O This is only true if the keys are ordered and independent, record numbers
483 .\"O for example.
484 .B R_IAFTER
485 ¤È
486 .B R_IBEFORE
487 ¤Ï
488 .B DB_RECNO
489 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ç¤·¤«ÍøÍѤǤ­¤Ê¤¤¡£
490 ¤³¤ì¤é¤ò¼Â¸½¤¹¤ë¤Ë¤Ï¡¢¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤¬
491 ¿·¤·¤¤¥­¡¼¤òºî¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£
492 ¤³¤ì¤¬À®Î©¤¹¤ë¤Î¤Ï¡¢Î㤨¤Ð¡¢½ç½ø¤Å¤±¤é¤¿ÆÈΩ¤Ê¥ì¥³¡¼¥ÉÈֹ椬
493 ¥­¡¼¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤è¤¦¤Ê¾ì¹ç¤À¤±¤Ç¤¢¤ë¡£
494 .IP
495 .\"O The default behavior of the
496 .I put
497 .\"O routines is to enter the new key/data pair, replacing any previously
498 .\"O existing key.
499 ¥ë¡¼¥Á¥ó¤Î¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï¡¢¿·¤·¤¤¥­¡¼/¥Ç¡¼¥¿ÂФò
500 ´û¤Ë¸ºß¤¹¤ë¥­¡¼¤òÃÖ¤­´¹¤¨¤ë»ö¤Æ³ÊǼ¤¹¤ëÆ°ºî¤Ç¤¢¤ë¡£
501 .IP
502 .I put
503 .\"O routines return \-1 on error (setting
504 .\"O .IR errno ),
505 .\"O 0 on success, and 1 if the
506 .\"O .B R_NOOVERWRITE
507 .\"O .I flag
508 .\"O was set and the key already exists in the file.
509 ¥ë¡¼¥Á¥ó¤Ï¥¨¥é¡¼¤Î¾ì¹ç \-1 ¤òÊÖ¤·
510 .RI ( errno
511 ¤ò¥»¥Ã¥È¤¹¤ë)¡¢À®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£¤Þ¤¿
512 .I flag
513 ¤Ë
514 .B R_NOOVERWRITE
515 ¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Æ¥­¡¼¤¬´û¤Ë¸ºß¤¹¤ë¾ì¹ç 1 ¤òÊÖ¤¹¡£
516 .TP
517 .I seq
518 .\"O A pointer to a routine which is the interface for sequential
519 .\"O retrieval from the database.
520 .\"O The address and length of the key are returned in the structure
521 .\"O referenced by
522 .\"O .IR key ,
523 .\"O and the address and length of the data are returned in the
524 .\"O structure referenced
525 .\"O by
526 .\"O .IR data .
527 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¥·¡¼¥±¥ó¥·¥ã¥ë¤Ë¥Ç¡¼¥¿¤ò¼è¤ê½Ð¤¹¤¿¤á¤Î
528 ¥ë¡¼¥Á¥ó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
529 ¥­¡¼¤Î¥¢¥É¥ì¥¹¤ÈŤµ¤¬
530 .I key
531 ¤¬»²¾È¤¹¤ë¹½Â¤ÂΤËÊÖ¤µ¤ì¤ë¡£¥Ç¡¼¥¿¤Î¥¢¥É¥ì¥¹¤ÈŤµ¤¬
532 .I data
533 ¤¬»²¾È¤¹¤ë¹½Â¤ÂΤËÊÖ¤µ¤ì¤ë¡£
534 .IP
535 .\"O Sequential key/data pair retrieval may begin at any time, and the
536 .\"O position of the "cursor" is not affected by calls to the
537 ¥·¡¼¥±¥ó¥·¥ã¥ë¤Ê¥­¡¼/¥Ç¡¼¥¿ÂФμèÆÀ¤Ï¤¤¤Ä¤Ç¤â¹Ô¤¨¤ë¡£¤Þ¤¿
538 ¡Ö¥«¡¼¥½¥ë¡×¤Î°ÌÃÖ¤Ï
539 .IR del ,
540 .IR get ,
541 .IR put ,
542 .\"O or
543 .I sync
544 .\"O routines.
545 ¥ë¡¼¥Á¥ó¤Î¸Æ¤Ó½Ð¤·¤Ë¤Ï±Æ¶Á¤µ¤ì¤Ê¤¤¡£
546 .\"O Modifications to the database during a sequential scan will be reflected
547 .\"O in the scan, that is,
548 .\"O records inserted behind the cursor will not be returned
549 .\"O while records inserted in front of the cursor will be returned.
550 ¥·¡¼¥±¥ó¥·¥ã¥ë¤Ê¥¹¥­¥ã¥ó¤ÎÅÓÃæ¤Ë¹Ô¤ï¤ì¤¿¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤ÎÊѹ¹¤Ï
551 ¥¹¥­¥ã¥ó¤ËÈ¿±Ç¤µ¤ì¤ë¡£¤¹¤Ê¤ï¤Á¡¢¥«¡¼¥½¥ë¤Î¸å¤í¤ËÁÞÆþ¤µ¤ì¤¿¥ì¥³¡¼¥É¤Ï
552 ÊÖ¤µ¤ì¤Ê¤¤¤¬¡¢¥«¡¼¥½¥ë¤ÎÁ°¤ËÁÞÆþ¤µ¤ì¤¿¥ì¥³¡¼¥É¤ÏÊÖ¤µ¤ì¤ë¡£
553 .IP
554 .\"O The flag value
555 .\"O .B must
556 .\"O be set to one of the following values:
557 ¥Õ¥é¥°ÃͤˤÏ\fBɬ¤º\fP°Ê²¼¤Ë¼¨¤¹¤¦¤Á¤Î
558 ¤É¤ì¤«°ì¤Ä¤ò¥»¥Ã¥È¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
559 .RS
560 .TP
561 .B R_CURSOR
562 .\"O The data associated with the specified key is returned.
563 .\"O This differs from the
564 .\"O .I get
565 .\"O routines in that it sets or initializes the cursor to the location of
566 .\"O the key as well.
567 .\"O (Note, for the
568 .\"O .B DB_BTREE
569 .\"O access method, the returned key is not necessarily an
570 .\"O exact match for the specified key.
571 .\"O The returned key is the smallest key greater than or equal to the specified
572 .\"O key, permitting partial key matches and range searches.)
573 »ØÄꤷ¤¿¥­¡¼¤Ë´ØÏ¢¤Å¤±¤é¤ì¤¿¥Ç¡¼¥¿¤¬ÊÖ¤µ¤ì¤ë¡£
574 .I get
575 ¥ë¡¼¥Á¥ó¤È¤Î°ã¤¤¤Ï¡¢¥«¡¼¥½¥ë¤¬¥­¡¼¤Î°ÌÃ֤˥»¥Ã¥È¤¢¤ë¤¤¤Ï
576 ½é´ü²½¤µ¤ì¤ëÅÀ¤Ç¤¢¤ë¡£
577 (Ãí°Õ:
578 .B DB_BTREE
579 ¥¢¥¯¥»¥¹ÊýË¡¤Ç¤Ï¡¢ÊÖ¤µ¤ì¤¿¥­¡¼¤¬
580 ɬ¤º¤·¤â»ØÄꤷ¤¿¥­¡¼¤ËÀµ¤·¤¯¥Þ¥Ã¥Á¤·¤Ê¤¤¤«¤â¤·¤ì¤Ê¤¤¡£
581 ÊÖ¤µ¤ì¤¿¥­¡¼¤Ï¡¢»ØÄꤵ¤ì¤¿¥­¡¼¤ËÅù¤·¤¤¤«¤è¤êÂ礭¤¤¤â¤Î¤Î¤¦¤Á
582 ºÇ¾®¤Î¤â¤Î¤Ë¤Ê¤ë
583 (Éôʬ¥­¡¼¥Þ¥Ã¥Á¤«Èϰϸ¡º÷¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ë¾ì¹ç)¡£)
584 .TP
585 .B R_FIRST
586 .\"O The first key/data pair of the database is returned, and the cursor
587 .\"O is set or initialized to reference it.
588 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎºÇ½é¤Î¥­¡¼/¥Ç¡¼¥¿ÂФ¬ÊÖ¤µ¤ì¤ë¡£
589 ¥«¡¼¥½¥ë¤Ï¤½¤ì¤ò»²¾È¤¹¤ë¤è¤¦¤Ë¥»¥Ã¥È¤Þ¤¿¤Ï½é´ü²½¤µ¤ì¤ë¡£
590 .TP
591 .B R_LAST
592 .\"O The last key/data pair of the database is returned, and the cursor
593 .\"O is set or initialized to reference it.
594 .\"O (Applicable only to the
595 .\"O .B DB_BTREE
596 .\"O and
597 .\"O .B DB_RECNO
598 .\"O access methods.)
599 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎºÇ¸å¤Î¥­¡¼/¥Ç¡¼¥¿ÂФ¬ÊÖ¤µ¤ì¤ë¡£¥«¡¼¥½¥ë¤Ï¤½¤ì¤ò»²¾È¤¹¤ë
600 ¤è¤¦¤Ë¥»¥Ã¥È¤Þ¤¿¤Ï½é´ü²½¤µ¤ì¤ë¡£
601 .RB ( DB_BTREE
602 ¤È
603 .B DB_RECNO
604 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤À¤±¤Ç»È¤¨¤ë¡£)
605 .TP
606 .B R_NEXT
607 .\"O Retrieve the key/data pair immediately after the cursor.
608 .\"O If the cursor is not yet set, this is the same as the
609 .\"O .B R_FIRST
610 .\"O flag.
611 ¥«¡¼¥½¥ëľ¸å¤Î¥­¡¼/¥Ç¡¼¥¿ÂФò¼èÆÀ¤¹¤ë¡£
612 ¥«¡¼¥½¥ë¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï
613 .B R_FIRST
614 ¥Õ¥é¥°¤ÈƱ¤¸¡£
615 .TP
616 .B R_PREV
617 .\"O Retrieve the key/data pair immediately before the cursor.
618 .\"O If the cursor is not yet set, this is the same as the
619 .\"O .B R_LAST
620 .\"O flag.
621 .\"O (Applicable only to the
622 .\"O .B DB_BTREE
623 .\"O and
624 .\"O .B DB_RECNO
625 .\"O access methods.)
626 ¥«¡¼¥½¥ëľÁ°¤Î¥­¡¼/¥Ç¡¼¥¿ÂФò¼èÆÀ¤¹¤ë¡£
627 ¥«¡¼¥½¥ë¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï
628 .B R_LAST
629 ¥Õ¥é¥°¤ÈƱ¤¸¡£
630 .RB ( DB_BTREE
631 ¤È
632 .B DB_RECNO
633 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤À¤±¤Ç»È¤¨¤ë¡£)
634 .RE
635 .IP
636 .\"O .B R_LAST
637 .\"O and
638 .\"O .B R_PREV
639 .\"O are available only for the
640 .\"O .B DB_BTREE
641 .\"O and
642 .\"O .B DB_RECNO
643 .\"O access methods because they each imply that the keys have an inherent
644 .\"O order which does not change.
645 .B R_LAST
646 ¤È
647 .B R_PREV
648 ¤Ï¡¢
649 .B DB_BTREE
650 ¤È
651 .B DB_RECNO
652 ¥¢¥¯¥»¥¹ÊýË¡¤Ç¤·¤«»È¤¨¤Ê¤¤¡£
653 ¤Ê¤¼¤Ê¤é
654 .B R_SETCURSOR
655 ¤òÍѤ¤¤ë¤Ë¤Ï¡¢Êѹ¹¤µ¤ì¤ë»ö¤Î̵¤¤¸ÇÍ­¤Î½ç½ø¤ò¥­¡¼¤¬»ý¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£
656 .IP
657 .I seq
658 .\"O routines return \-1 on error (setting
659 .\"O .IR errno ),
660 .\"O 0 on success and 1 if there are no key/data pairs less than or greater
661 .\"O than the specified or current key.
662 .\"O If the
663 .\"O .B DB_RECNO
664 .\"O access method is being used, and if the database file
665 .\"O is a character special file and no complete key/data pairs are currently
666 .\"O available, the
667 .\"O .I seq
668 .\"O routines return 2.
669 ¥ë¡¼¥Á¥ó¤Ï¥¨¥é¡¼¤Î¾ì¹ç \-1 ¤òÊÖ¤·
670 .RI ( errno
671 ¤ò¥»¥Ã¥È¤¹¤ë)¡¢
672 À®¸ù¤Î¾ì¹ç 0 ¤òÊÖ¤¹¡£
673 »ØÄꤷ¤¿¥­¡¼¤ä¥«¥ì¥ó¥È¥­¡¼¤è¤ê¤âÂ礭¤¤/¾®¤µ¤¤¥­¡¼/¥Ç¡¼¥¿ÂФ¬¤Ê¤¤¾ì¹ç¤Ï
674 1 ¤òÊÖ¤¹¡£
675 .B DB_RECNO
676 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤ò»È¤Ã¤Æ¤¤¤Æ¡¢
677 ¤«¤Ä¥Ç¡¼¥¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë¤¬Ê¸»ú·¿¤Î¥¹¥Ú¥·¥ã¥ë¥Õ¥¡¥¤¥ë¤Ç¡¢
678 ´°À®¤·¤Æ¤¤¤ë¥­¡¼/¥Ç¡¼¥¿ÂФ¬Ìµ¤¤¾ì¹ç¤Ë¤Ï¡¢
679 .I seq
680 ¥ë¡¼¥Á¥ó¤Ï 2 ¤òÊÖ¤¹¡£
681 .TP
682 .I sync
683 .\"O A pointer to a routine to flush any cached information to disk.
684 .\"O If the database is in memory only, the
685 .\"O .I sync
686 .\"O routine has no effect and will always succeed.
687 ¥­¥ã¥Ã¥·¥å¤µ¤ì¤¿¾ðÊó¤ò¥Ç¥£¥¹¥¯¤ËÁݤ­½Ð¤¹¥ë¡¼¥Á¥ó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
688 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤¬¥á¥â¥ê¤ÎÃæ¤À¤±¤Ë¤¢¤ë¾ì¹ç¡¢
689 .I sync
690 ¥ë¡¼¥Á¥ó¤Ï²¿¤Î¸ú²Ì¤â¤Ê¤¯¾ï¤ËÀ®¸ù¤¹¤ë¡£
691 .IP
692 .\"O The flag value may be set to the following value:
693 flag ¤Ë¤Ï°Ê²¼¤ÎÃͤ¬¥»¥Ã¥È¤Ç¤­¤ë¡£
694 .RS
695 .TP
696 .B R_RECNOSYNC
697 .\"O If the
698 .\"O .B DB_RECNO
699 .\"O access method is being used, this flag causes
700 .\"O the sync routine to apply to the btree file which underlies the
701 .\"O recno file, not the recno file itself.
702 .B DB_RECNO
703 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤ò»È¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë
704 ¤³¤Î¥Õ¥é¥°¤ò¥»¥Ã¥È¤¹¤ë¤È¡¢
705 recno ¥Õ¥¡¥¤¥ë¤½¤Î¤â¤Î¤Ë¤Ç¤Ï¤Ê¤¯¡¢
706 ¤½¤Î¥Ù¡¼¥¹¤Ë¤Ê¤Ã¤Æ¤¤¤ë btree ¥Õ¥¡¥¤¥ë¤Ë sync ¤¬¹Ô¤ï¤ì¤ë¡£
707 .\"O (See the
708 .\"O .I bfname
709 .\"O field of the
710 .\"O .BR recno (3)
711 .\"O manual page for more information.)
712 (¾ÜºÙ¤Ï
713 .BR recno (3)
714 ¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ç
715 .I bfname
716 ¥Õ¥£¡¼¥ë¥É¤òÀâÌÀ¤·¤Æ¤¤¤ëÉôʬ¤ò»²¾È¤Î¤³¤È¡£)
717 .RE
718 .IP
719 .I sync
720 .\"O routines return \-1 on error (setting
721 .\"O .IR errno )
722 .\"O and 0 on success.
723 ¥ë¡¼¥Á¥ó¤Ï¥¨¥é¡¼¤Î¾ì¹ç \-1 ¤òÊÖ¤·
724 .RI ( errno
725 ¤ò¥»¥Ã¥È¤¹¤ë)¡¢À®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤¹¡£
726 .\"O .SS "Key/Data Pairs"
727 .SS ¥­¡¼/¥Ç¡¼¥¿ÂÐ
728 .\"O Access to all file types is based on key/data pairs.
729 .\"O Both keys and data are represented by the following data structure:
730 Á´¤Æ¤Î¥Õ¥¡¥¤¥ë¥¿¥¤¥×¤Ë¤ª¤¤¤Æ¡¢
731 ¥­¡¼/¥Ç¡¼¥¿ÂФò¥Ù¡¼¥¹¤Ë¤·¤Æ¥¢¥¯¥»¥¹¤¬¹Ô¤ï¤ì¤ë¡£
732 ¥­¡¼¤È¥Ç¡¼¥¿¤Î¤¤¤º¤ì¤â¡¢¼¡¤Î¥Ç¡¼¥¿¹½Â¤¤Çµ­½Ò¤µ¤ì¤ë¡£
733 .in +4n
734 .nf
735
736 typedef struct {
737     void  *data;
738     size_t size;
739 } DBT;
740 .fi
741 .in
742 .\"O The elements of the
743 .\"O .I DBT
744 .\"O structure are defined as follows:
745 .I DBT
746 ¹½Â¤ÂΤγÆÍ×ÁǤϼ¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
747 .TP
748 .I data
749 .\"O A pointer to a byte string.
750 ¥Ð¥¤¥Èʸ»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
751 .TP
752 .I size
753 .\"O The length of the byte string.
754 ¥Ð¥¤¥Èʸ»úÎó¤ÎŤµ¡£
755 .PP
756 .\"O Key and data byte strings may reference strings of essentially unlimited
757 .\"O length although any two of them must fit into available memory at the same
758 .\"O time.
759 ¥­¡¼¤È¥Ç¡¼¥¿¤Î¥Ð¥¤¥Èʸ»úÎó¤Ï¡¢
760 ´ðËÜŪ¤Ë¤Ï̵À©¸Â¤ÎŤµ¤Îʸ»úÎó¤ò»²¾È¤Ç¤­¤ë¤¬¡¢
761 ¤·¤«¤·¤¤¤º¤ì¤â»ÈÍѲÄǽ¤Ê¥á¥â¥ê¤Ë¼ý¤Þ¤Ã¤Æ¤¤¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
762 .\"O It should be noted that the access methods provide no guarantees about
763 .\"O byte string alignment.
764 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ï¥Ð¥¤¥Èʸ»úÎó¤Î¥¢¥é¥¤¥ó¥á¥ó¥È¤Ë¤Ä¤¤¤Æ¤Ï
765 ²¿¤âÊݾڤ·¤Æ¤¤¤Ê¤¤»ö¤ËÃí°Õ¤¹¤ë¤³¤È¡£
766 .SH ¥¨¥é¡¼
767 .\"O The
768 .\"O .BR dbopen ()
769 .\"O routine may fail and set
770 .\"O .I errno
771 .\"O for any of the errors specified for the library routines
772 .\"O .BR open (2)
773 .\"O and
774 .\"O .BR malloc (3)
775 .\"O or the following:
776 .BR dbopen ()
777 ¥ë¡¼¥Á¥ó¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
778 .BR open (2)
779 ¤È
780 .BR malloc (3)
781 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
782 .I errno
783 ¤ò¥»¥Ã¥È¤¹¤ë¡£¤¢¤ë¤¤¤Ï°Ê²¼¤ò¥»¥Ã¥È¤¹¤ë¡£
784 .TP
785 .B [EFTYPE]
786 .\"O A file is incorrectly formatted.
787 ¥Õ¥¡¥¤¥ë¤¬Àµ¤·¤¯¥Õ¥©¡¼¥Þ¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
788 .TP
789 .B [EINVAL]
790 .\"O A parameter has been specified (hash function, pad byte etc.) that is
791 .\"O incompatible with the current file specification or which is not
792 .\"O meaningful for the function (for example, use of the cursor without
793 .\"O prior initialization) or there is a mismatch between the version
794 .\"O number of file and the software.
795 »ØÄꤷ¤¿¥Ñ¥é¥á¡¼¥¿(¥Ï¥Ã¥·¥å´Ø¿ô¡¢¥Ð¥¤¥ÈËä¤á¤Ê¤É)¤¬¸½ºß¤Î¥Õ¥¡¥¤¥ë»ÅÍͤË
796 ¹ç¤Ã¤Æ¤¤¤Ê¤¤¡¢¥Ñ¥é¥á¡¼¥¿¤¬´Ø¿ô¤Ë¤È¤Ã¤Æ̵°ÕÌ£
797 (Î㤨¤Ð¤¢¤é¤«¤¸¤á½é´ü²½¤·¤Ê¤¤¤Ç¥«¡¼¥½¥ë¤ò»È¤¦¤È¤«)¡¢
798 ¥Õ¥¡¥¤¥ë¤È¥½¥Õ¥È¥¦¥§¥¢¤Î¥Ð¡¼¥¸¥ç¥ó¤¬¹ç¤Ã¤Æ¤¤¤Ê¤¤¡£
799 .PP
800 .\"O The
801 .I close
802 .\"O routines may fail and set
803 ¥ë¡¼¥Á¥ó¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
804 .\"O .I errno
805 .\"O for any of the errors specified for the library routines
806 .BR close (2),
807 .BR read (2),
808 .BR write (2),
809 .BR free (3),
810 .\"O or
811 .BR fsync (2)
812 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
813 .I errno
814 ¤ò¥»¥Ã¥È¤¹¤ë¡£
815 .PP
816 .\"O The
817 .IR del ,
818 .IR get ,
819 .I put
820 .\"O and
821 ¤È
822 .I seq
823 .\"O routines may fail and set
824 ¥ë¡¼¥Á¥ó¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
825 .\"O .I errno
826 .\"O for any of the errors specified for the library routines
827 .BR read (2),
828 .BR write (2),
829 .BR free (3),
830 .\"O or
831 .BR malloc (3)
832 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
833 .I errno
834 ¤ò¥»¥Ã¥È¤¹¤ë¡£
835 .PP
836 .\"O The
837 .\"O .I fd
838 .\"O routines will fail and set
839 .\"O .I errno
840 .\"O to
841 .\"O .B ENOENT
842 .\"O for in memory databases.
843 .I fd
844 ¥ë¡¼¥Á¥ó¤Ï¥á¥â¥êÆâ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ËÂФ·¼ºÇÔ¤¹¤ë¤È
845 .I errno
846 ¤Ë
847 .B ENOENT
848 ¤ò¥»¥Ã¥È¤¹¤ë¡£
849 .PP
850 .\"O The
851 .I sync
852 .\"O routines may fail and set
853 ¥ë¡¼¥Á¥ó¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
854 .\"O .I errno
855 .\"O for any of the errors specified for the library routine
856 .BR fsync (2)
857 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
858 .I errno
859 ¤ò¥»¥Ã¥È¤¹¤ë¡£
860 .SH ¥Ð¥°
861 .\"O The typedef
862 .\"O .I DBT
863 .\"O is a mnemonic for "data base thang", and was used
864 .\"O because no-one could think of a reasonable name that wasn't already used.
865 typedef
866 .I DBT
867 ¤Ï ``data base thang''¤Îά¸ì¤Ç¤¢¤ë¤¬¡¢¤³¤ì¤¬»È¤ï¤ì¤Æ¤¤¤ë¤Î¤Ï¡¢
868 ¤Þ¤À»È¤ï¤ì¤Æ¤¤¤Ê¤¤ÂÅÅö¤Ê̾Á°¤¬»×¤¤ÉÕ¤«¤Ê¤«¤Ã¤¿¤¿¤á¤Ç¤¢¤ë¡£
869 .PP
870 .\"O The file descriptor interface is a kludge and will be deleted in a
871 .\"O future version of the interface.
872 ¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤ò»È¤Ã¤¿¤ä¤ê¤È¤ê¤Ï¤Ò¤É¤¤Âåʪ¤Ç¤¢¤ê¡¢
873 ¾­Íè¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ïºï½ü¤µ¤ì¤ë¤À¤í¤¦¡£
874 .PP
875 .\"O None of the access methods provide any form of concurrent access,
876 .\"O locking, or transactions.
877 ¤É¤Î¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤â¡¢Æ±»þ¥¢¥¯¥»¥¹¡¢¥í¥Ã¥¯¡¢¥È¥é¥ó¥¶¥¯¥·¥ç¥ó
878 ¤Î»ÅÁȤߤÏÈ÷¤¨¤Æ¤¤¤Ê¤¤¡£
879 .SH ´ØÏ¢¹àÌÜ
880 .BR btree (3),
881 .BR hash (3),
882 .BR mpool (3),
883 .BR recno (3)
884 .sp
885 .IR "LIBTP: Portable, Modular Transactions for UNIX" ,
886 Margo Seltzer, Michael Olson, USENIX proceedings, Winter 1992.