OSDN Git Service

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