1 .\" Copyright (c) 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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
32 .\" @(#)recno.3 8.5 (Berkeley) 8/18/94
34 .\" Japanese Version Copyright (c) 1999 Shouichi Saito
35 .\" all rights reserved.
36 .\" Translated Mon Jul 26 12:18:39 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>
40 .\"WORD: access method ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É
41 .\"WORD: pad character Ëä¤áʸ»ú
42 .TH RECNO 3 1994-08-18 "" "Linux Programmer's Manual"
45 .\"O recno \- record number database access method
46 recno \- ¥ì¥³¡¼¥ÉÈÖ¹æ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤Î¥¢¥¯¥»¥¹¥á¥½¥Ã¥É
50 #include <sys/types.h>
57 .\"O is the library interface to database files.
60 ¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ë¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ç¤¢¤ë¡£
61 .\"O One of the supported file formats is record number files.
62 .\"O The general description of the database access methods is in
64 .\"O this manual page describes only the recno specific information.
65 ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¥Õ¥©¡¼¥Þ¥Ã¥È¤Î°ì¤Ä¤Ë¡¢
66 ¥ì¥³¡¼¥ÉÈÖ¹æ¥Õ¥¡¥¤¥ë (record number file: recno file) ¤¬¤¢¤ë¡£
67 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤Î¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ë´Ø¤¹¤ë°ìÈÌŪ¤Êµ½Ò¤Ï
70 ¤³¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ç¤Ï recno ÆÃͤξðÊó¤Ë¤Ä¤¤¤Æ¤Î¤ßµ½Ò¤¹¤ë¡£
72 .\"O The record number data structure is either variable or fixed-length
73 .\"O records stored in a flat-file format, accessed by the logical record
75 ¥ì¥³¡¼¥ÉÈÖ¹æ¥Ç¡¼¥¿¹½Â¤¤Ï¡¢¥Õ¥é¥Ã¥È¤Ê¥Õ¥¡¥¤¥ë·Á¼°¤Ë³ÊǼ¤µ¤ì¤¿
76 ²ÄÊÑĹ/¸ÇÄêĹ¥ì¥³¡¼¥É¤«¤é¤Ê¤ê¡¢ÏÀÍý¥ì¥³¡¼¥ÉÈÖ¹æ¤Ç¥¢¥¯¥»¥¹¤µ¤ì¤ë¡£
77 .\"O The existence of record number five implies the existence of records
78 .\"O one through four, and the deletion of record number one causes
79 .\"O record number five to be renumbered to record number four, as well
80 .\"O as the cursor, if positioned after record number one, to shift down
82 ¥ì¥³¡¼¥ÉÈÖ¹æ 5 ¤¬¤¢¤ì¤Ð¡¢¥ì¥³¡¼¥ÉÈÖ¹æ 1 ¤«¤é 4 ¤â¸ºß¤¹¤ë¡£
83 ¥ì¥³¡¼¥ÉÈÖ¹æ 1 ¤òºï½ü¤¹¤ë¤È¡¢¥ì¥³¡¼¥ÉÈÖ¹æ 5 ¤Ï 4 ¤ËÉÕ¤±Âؤ¨¤é¤ì¡¢
84 ¥«¡¼¥½¥ë¤â°ÜÆ°¤¹¤ë¡£¥ì¥³¡¼¥ÉÈÖ¹æ 1 °Ê¹ß¤Î¤â¤Î¤Ï°ì¤Ä·«¤ê¾å¤¬¤ë¤ï¤±¤Ç¤¢¤ë¡£
86 .\"O The recno access method specific data structure provided to
88 .\"O is defined in the
90 .\"O include file as follows:
92 ¤Ç»È¤¦ recno ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤ËÆÃͤΥǡ¼¥¿¹½Â¤ÂΤϡ¢
94 ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤Ç¼¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
100 unsigned int cachesize;
110 .\"O The elements of this structure are defined as follows:
111 ¤³¤Î¹½Â¤ÂΤÎÍ×ÁǤò°Ê²¼¤Ë¼¨¤¹¡£
114 .\"O The flag value is specified by ORing
115 .\"O any of the following values:
116 flag ¤ÎÃͤϰʲ¼¤ÎÃͤÎÏÀÍýϤǻØÄꤵ¤ì¤ë¡£
120 .\"O The records are fixed-length, not byte delimited.
121 ¥ì¥³¡¼¥ÉŤ¬¸ÇÄê¤Ç¤¢¤ê¡¢¥Ð¥¤¥È¶èÀÚ¤ê¤Ç¤Ï¤Ê¤¤¡£
122 .\"O The structure element
124 .\"O specifies the length of the record, and the structure element
126 .\"O is used as the pad character.
129 ¤Ï¥ì¥³¡¼¥É¤ÎŤµ¤ò»ØÄꤹ¤ë¡£¤Þ¤¿¡¢Í×ÁÇ
131 ¤ÏËä¤áʸ»ú (pad character) ¤ò»ØÄꤹ¤ë¡£
132 .\"O Any records, inserted into the database, that are less than
134 .\"O bytes long are automatically padded.
135 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤ËÆþ¤ì¤é¤ì¤¿¥ì¥³¡¼¥É¤ÎÆâ
137 ¥Ð¥¤¥È¤ËËþ¤¿¤Ê¤¤¤â¤Î¤Ç¤Ï¡¢»Ä¤ê¤ÎÉôʬ¤ËËä¤áʸ»ú¤¬¼«Æ°Åª¤ËÆþ¤ë¡£
140 .\"O In the interface specified by
142 .\"O the sequential record retrieval fills in both the caller's key and
143 .\"O data structures.
145 ¤Ç»ØÄꤵ¤ì¤¿¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤Ç¤Ï¡¢¥·¡¼¥±¥ó¥·¥ã¥ë¤Ê¥ì¥³¡¼¥É¼èÆÀ¤Ï
146 ¸Æ¤Ó½Ð¤·¥¡¼¤È¥Ç¡¼¥¿¹½Â¤ÂΤÎξÊý¤òËä¤á¤Æ¤¤¤¯¡£
149 .\"O flag is specified, the
151 .\"O routines are not required to fill in the key structure.
152 .\"O This permits applications to retrieve records at the end of files without
153 .\"O reading all of the intervening records.
155 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤È¡¢¥¡¼¹½Â¤ÂΤòËä¤á¤ë¤Î¤Ë
157 ¥ë¡¼¥Á¥ó¤òɬÍפȤ·¤Ê¤¤¡£
158 ¤³¤ì¤òÍѤ¤¤ì¤Ð¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬¥Õ¥¡¥¤¥ë¤Î½ª¤ê¤ÎÊý¤ò¼èÆÀ¤¹¤ëºÝ¤Ë¡¢
159 ¤½¤ÎÅÓÃæ¤Î¥ì¥³¡¼¥É¤òÆɤޤʤ¯¤Æ¤âºÑ¤à»ö¤Ë¤Ê¤ë¡£
162 .\"O This flag requires that a snapshot of the file be taken when
164 .\"O is called, instead of permitting any unmodified records to be read from
165 .\"O the original file.
166 ¤³¤Î¥Õ¥é¥°¤ò»ØÄꤹ¤ë¤È¡¢
169 ¥ª¥ê¥¸¥Ê¥ë¥Õ¥¡¥¤¥ë¤«¤éÊѹ¹¤µ¤ì¤Æ¤¤¤Ê¤¤¥ì¥³¡¼¥É¤òÆɤàÂå¤ï¤ê¤Ë¡¢
170 ¥Õ¥¡¥¤¥ë¤Î snapshot ¤òÍѤ¤¤ë¡£
174 .\"O A suggested maximum size, in bytes, of the memory cache.
177 .\"O advisory, and the access method will allocate more memory rather than fail.
180 .\"O is 0 (no size is specified) a default cache is used.
181 ÁÛÄꤵ¤ì¤ë¥á¥â¥ê¥¥ã¥Ã¥·¥å¤ÎºÇÂ祵¥¤¥º (¥Ð¥¤¥Èñ°Ì)¡£
184 »²¹Í¤Ç¤¢¤ê¡¢¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ï¤³¤ÎÃͤò±Û¤¨¤¿¥á¥â¥ê¤Î
185 ³ä¤êÅö¤Æ¤ËÀ®¸ù¤¹¤ë¤³¤È¤â¤¢¤ë¡£
187 ¤¬ 0 (¤¢¤ë¤¤¤Ï»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢¥Ç¥Õ¥©¥ë¥È¤Î¥¥ã¥Ã¥·¥å¤¬»È¤ï¤ì¤ë¡£
190 .\"O The recno access method stores the in-memory copies of its records
192 .\"O This value is the size (in bytes) of the pages used for nodes in that tree.
193 recno ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ï¡¢¼«¿È¤Î¥ì¥³¡¼¥É¤Î¥³¥Ô¡¼¤ò¥á¥â¥êÆâÉô¤Ë
194 btree ¤ÇÊݸ¤·¤Æ¤¤¤ë¡£
195 ¤³¤ÎÃͤϡ¢¤½¤Î btree Ãæ¤Î¥Î¡¼¥É¤ËÂФ·¤ÆÍѤ¤¤é¤ì¤ë
196 ¥Ú¡¼¥¸¥µ¥¤¥º (¥Ð¥¤¥Èñ°Ì) ¤Ç¤¢¤ë¡£
199 .\"O is 0 (no page size is specified) a page size is chosen based on the
200 .\"O underlying file system I/O block size.
203 .\"O for more information.
205 ¤¬ 0 (¤¢¤ë¤¤¤Ï»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢
206 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î I/O ¥Ö¥í¥Ã¥¯¥µ¥¤¥º¤ò´ð¤Ë¤·¤Æ
207 ¥Ú¡¼¥¸¥µ¥¤¥º¤¬·è¤á¤é¤ì¤ë¡£
213 .\"O The byte order for integers in the stored database metadata.
214 .\"O The number should represent the order as an integer; for example,
215 .\"O big endian order would be the number 4,321.
218 .\"O is 0 (no order is specified) the current host order is used.
219 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë³ÊǼ¤µ¤ì¤Æ¤¤¤ë¥á¥¿¥Ç¡¼¥¿¤ÎÀ°¿ôÃͤΥХ¤¥È¥ª¡¼¥À¡¼¡£
220 ¤³¤Î¿ô»ú¤Ï¡¢½ç½ø¤òÀ°¿ô¤Çɽ¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£
221 Î㤨¤Ð¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ê¤é¡¢¤³¤Î¿ôÃÍ¤Ï 4,321 ¤È¤Ê¤ë¡£
223 ¤¬ 0 (»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢¸½ºß¤Î¥Û¥¹¥È
224 ¤Ç»È¤ï¤ì¤Æ¤¤¤ë¥Ð¥¤¥È¥ª¡¼¥À¡¼¤¬»È¤ï¤ì¤ë¡£
227 .\"O The length of a fixed-length record.
228 ¸ÇÄê¥ì¥³¡¼¥ÉŤÎŤµ¡£
231 .\"O The delimiting byte to be used to mark the end of a record for
232 .\"O variable-length records, and the pad character for fixed-length
234 ²ÄÊѥ쥳¡¼¥ÉŤˤª¤¤¤Æ¡¢
235 ¥ì¥³¡¼¥É¤Î½ª¤ê¤ò¼¨¤¹¶èÀÚ¤ê¥Ð¥¤¥È (¶èÀÚ¤êʸ»ú) ¤Ç¤¢¤ë¡£
236 ¸ÇÄê¥ì¥³¡¼¥ÉŤǤÏËä¤áʸ»ú¤È¤·¤Æ»È¤ï¤ì¤ë¡£
237 .\"O If no value is specified, newlines ("\en") are used to mark the end
238 .\"O of variable-length records and fixed-length records are padded with
240 Ãͤ¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤È¡¢
241 ²ÄÊѥ쥳¡¼¥ÉĹ¤Î¥ì¥³¡¼¥É¤Î½ª¤ê¤Ë¤Ï²þ¹Ô ("\en") ¤¬»È¤ï¤ì¤ë¡£
242 ¸ÇÄê¥ì¥³¡¼¥ÉĹ¤Î¥ì¥³¡¼¥É¤Ï¶õÇò (space) ¤ÇËä¤á¤é¤ì¤ë¡£
245 .\"O The recno access method stores the in-memory copies of its records
249 .\"O is non-NULL, it specifies the name of the btree file,
250 .\"O as if specified as the filename for a
252 .\"O of a btree file.
253 recno ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ï¡¢
254 ¼«¿È¤Î¥ì¥³¡¼¥É¤Î¥³¥Ô¡¼¤ò¥á¥â¥êÆâÉô¤Ç btree ¤ËÊݸ¤·¤Æ¤¤¤ë¡£
256 ¤¬ NULL ¤Ç¤Ê¤¤¾ì¹ç¡¢¤³¤ì¤Ï btree ¥Õ¥¡¥¤¥ë̾
259 ¤¹¤ë»þ¤Ë»ØÄꤹ¤ë¥Õ¥¡¥¤¥ë̾) ¤ò»ØÄꤹ¤ë¡£
261 .\"O The data part of the key/data pair used by the
264 .\"O is the same as other access methods.
266 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ç»È¤ï¤ì¤ë¥¡¼/¥Ç¡¼¥¿ÂФΥǡ¼¥¿Éôʬ¤Ï¡¢
267 ¾¤Î¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤ÈƱ¤¸¤Ç¤¢¤ë¡£
268 .\"O The key is different.
271 .\"O field of the key should be a pointer to a memory location of type
273 .\"O as defined in the
276 ¤·¤«¤·¥¡¼¤Ï°Û¤Ê¤Ã¤Æ¤¤¤ë¡£
281 ·¿¤Î¡¢¥á¥â¥ê°ÌÃ֤ؤΥݥ¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
285 ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
286 .\"O This type is normally the largest unsigned integral type available to
287 .\"O the implementation.
288 ¤³¤Î·¿¤ÏÄ̾¤½¤Î¼ÂÁõ¤ÇÍøÍѲÄǽ¤ÊºÇÂç¤ÎÉä¹æ̵¤·À°¿ô¤Ç¤¢¤ë¡£
291 .\"O field of the key should be the size of that type.
294 ¥Õ¥£¡¼¥ë¥É¤Ï¤½¤Î·¿¤Î¥µ¥¤¥º¤È¤Ê¤ë¡£
296 .\"O Because there can be no metadata associated with the underlying
297 .\"O recno access method files, any changes made to the default values
298 .\"O (e.g., fixed record length or byte separator value) must be explicitly
299 .\"O specified each time the file is opened.
300 recno ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Î¥Õ¥¡¥¤¥ë¤Ë´ØÏ¢¤Å¤±¤é¤ì¤ë
301 ¥á¥¿¥Ç¡¼¥¿¤Ï¸ºß¤Ç¤¤Ê¤¤¤«¤é¡¢
302 ¥Ç¥Õ¥©¥ë¥ÈÃÍ (¸ÇÄê¥ì¥³¡¼¥ÉĹ¤ä¥»¥Ñ¥ì¡¼¥¿Ê¸»ú¤Ê¤É)
303 ¤ËÂФ¹¤ëÊѹ¹¤Ï¥Õ¥¡¥¤¥ë¤ò³«¤¯Ëè¤ËÌÀ¼¨Åª¤Ë»ØÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
305 .\"O In the interface specified by
309 .\"O interface to create a new record will cause the creation of multiple,
310 .\"O empty records if the record number is more than one greater than the
311 .\"O largest record currently in the database.
313 ¤Ç»ØÄꤵ¤ì¤¿¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤Ç¤Ï¡¢
315 ¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤ò»È¤Ã¤Æ¿·¤·¤¤¥ì¥³¡¼¥É¤òºîÀ®¤¹¤ë¤È¤¤Ë¡¢
316 »ØÄꤷ¤¿¥ì¥³¡¼¥ÉÈֹ椬¥Ç¡¼¥¿¥Ù¡¼¥¹Ãæ¤Ë¸ºß¤·¤Æ¤¤¤ëºÇÂç¥ì¥³¡¼¥ÉÈÖ¹æ¤è¤ê
318 ¶õ¤Î¥ì¥³¡¼¥É¤¬Æ±»þ¤Ë¤Ç¤¤Æ¤·¤Þ¤¦¡£
322 .\"O access method routines may fail and set
324 .\"O for any of the errors specified for the library routine
326 .\"O or the following:
328 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¥ë¡¼¥Á¥ó¤Ï¼ºÇÔ¤¹¤ë¤È
330 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
337 .\"O An attempt was made to add a record to a fixed-length database that
338 .\"O was too large to fit.
339 ¸ÇÄêĹ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¥ì¥³¡¼¥É¤òÄɲ乤ë¤È¤¡¢¥Ç¡¼¥¿¤¬Ä¹¤¹¤®¤¿¡£
341 .\"O Only big and little endian byte order is supported.
342 ¥Ð¥¤¥È¥ª¡¼¥À¡¼¤È¤·¤Æ¤Ï¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤È¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Î¤ß¤¬
350 .IR "Document Processing in a Relational Database System" ,
351 Michael Stonebraker, Heidi Stettner, Joseph Kalash, Antonin Guttman,
352 Nadene Lynn, Memorandum No. UCB/ERL M82/32, May 1982.