Berkeley DB Reference Guide:
Access Methods

PrevRefNext

Managing record-based databases

When using fixed- or variable-length record-based databases, particularly with flat-text backing files, there are several items that the user can control. The Recno access method can be used to store either variable- or fixed-length data items. By default, the Recno access method stores variable-length data items. The Queue access method can only store fixed-length data items.

( flat-text backing filesÀ» »ç¿ëÇÏ¿© °íÁ¤¶Ç´Â °¡º¯ ·¹Äڵ带 »ç¿ëÇÒ¶§ »ç¿ëÀÚ°¡ Á¦¾îÇØ¾ß ÇÏ´Â ¿©·¯ ¾ÆÀÌÅÛÀÌ ÀÖ°Ô µÈ´Ù.Recno¿¢¼¼½º ¸Þ¼Òµå´Â °íÁ¤,°¡º¯Å©±âÀÇ µ¥ÀÌŸ¾ÆÀÌÅÛÀ» ÀúÀåÇÒ ¼ö ÀÖ´Ù.µðÆúÆ®·Î Recno´Â °¡º¯Å©±âÀÇ µ¥ÀÌŸ¾ÆÀÌÅÛÀ» ÀúÁ¤ÇÑ´Ù.Queue´Â ¿ÀÁ÷ °íÁ¤Å©±âÀÇ µ¥ÀÌŸ¾ÆÀÌÅÛÀ» ÀúÀåÇÒ ¼ö ÀÖ´Ù.)

¡¡

Record Delimiters

When using the Recno access method to store variable-length records, records read from any backing source file are separated by a specific byte value which marks the end of one record and the beginning of the next. This delimiting value is ignored except when reading records from a backing source file, that is, records may be stored into the database that include the delimiter byte. However, if such records are written out to the backing source file and the backing source file is subsequently read into a database, the records will be split where delimiting bytes were found.

(°¡º¯±æÀÌ ·¹Äڵ带 ÀúÀåÇϱâ À§ÇØ Recno¸¦ »ç¿ëÇÒ¶§ backing¼Ò½ºÆÄÀÏ·Î ºÎÅÍ ÀÐÀº ·¹ÄÚµå´Â ƯÁ¤ÇÑ ¹ÙÀÌÆ®¿¡ ÀÇÇØ ´ÙÀ½ ·¹ÄÚµå¿Í ±¸º°µÈ´Ù.ÀÌ ±¸º°ÀÚ¹ÙÀÌÆ®´Â ·¹ÄÚµå¿Í ÇÔ²² ÀúÀåµÇ°í ÀÐÀ»¶§ ¹«½ÃµÈ´Ù.±×·¯³ª ¸¸¾à backing¼Ò½ºÆÄÀϷκÎÅÍ ·¹Äڵ尡 ½áÁö°í backing¼Ò½ºÆÄÀÏÀÌ µðºñ¿¡ ¿¬¼ÓÀûÀ¸·Î ÀоîÁö¸é,·¹ÄÚµåµéÀº ±¸º°ÀÚ¹ÙÀÌÆ®¿¡ ÀÇÇØ ±¸º°µÈ´Ù.)

For example, UNIX text files can usually be interpreted as a sequence of variable-length records separated by ASCII newline characters. This byte value (ASCII 0x0a) is the default delimiter. Applications may specify a different delimiting byte using the DB->set_re_delim method. If no backing source file is being used, there is no reason to set the delimiting byte value.

(¿¹¸¦µé¾î,À¯´Ð½º ÅؽºÆ®ÆÄÀÏÀº ´º¶óÀΠij¸¯ÅÍ¿¡ ÀÇÇØ ±¸º°µÇ´Â °¡º¯±æÀÇ ·¹ÄÚµåÀÇ ¿¬¼ÓÀ¸·Î Çؼ®µÉ¼ö ÀÖ´Ù.ÀÌ ¹ÙÀÌÆ®°ª(ASCII 0x0a)Àº µðÆúµå ±¸º°ÀÚÀÌ´Ù.¾ÖÇø®ÄÉÀ̼ÇÀº DB->set_re_delim ¸¦ »ç¿ëÇÏ¿© ´Ù¸¥ ±¸º°ÀÚ¸¦ ¼³Á¤ÇÒ ¼ö ÀÕµû.¸¸¾à backing¼Ò½ºÆÄÀÏÀÌ »ç¿ëµÇÁö ¾ÊÀ»¶§ ±¸º°ÀÚ¹ÙÀÌÆ®¸¦ ¼³Á¤ÇÏÁö ¾Ê¾Æ¾ß ÇÑ´Ù.)

Record Length

When using the Recno or Queue access methods to store fixed-length records, the record length must be specified. Since the Queue access method always uses fixed-length records, the user must always set the record length prior to creating the database. Setting the record length is what causes the Recno access method to store fixed-length, not variable-length, records.

(Recno ¶Ç´Â Queue ¸¦ °íÁ¤±æÀÌÀÇ ·¹ÄÚµå ÀúÀåÀ» À§ÇØ »ç¿ëÇÒ¶§ ·¹ÄÚµå±æÀÌ°¡ ¼³Á¤µÇ¾î¾ß ÇÑ´Ù.Queue´Â Ç×»ó °íÁ¤±æÀÌÀÇ ·¹Äڵ带 »ç¿ëÇϱ⠶§¹®¿¡ »ç¿ëÀÚ´Â Ç×»ó µðºñ»ý¼º½Ã ·¹ÄÚµå±æÀ̸¦ ¼³Á¤ÇØ¾ß ÇÑ´Ù.RecnoÀÇ ·¡ÄÚµåÀÇ ±æÀ̸¦ ¼³Á¤ÇÏ¸é °íÁ¤±æÀÌÀÇ ·¹Äڵ带 »ç¿ëÇÏ°Ô µÈ´Ù.)

The length of the records is specified by calling the DB->set_re_len method. The default length of the records is 0 bytes. Any record read from a backing source file or otherwise stored in the database that is shorter than the declared length will automatically be padded as described for the DB->set_re_pad method. Any record stored that is longer than the declared length results in an error. For further information on backing source files, see Flat-text backing files.

(·¹ÄÚµå±æÀÌ´Â DB->set_re_len ·Î ¼³Á¤ÇÑ´Ù.µðÆúÆ®°ªÀº 0 ¹ÙÀÌÆ®´Ù.¼±¾ðµÈ ±æÀ̺¸´Ù ªÀº µðºñ¿¡ ÀúÀåµÈ ·¹Äڵ峪 backing¼Ò½ºÆÄÀÏ·Î ºÎÅÍ ÀÐÀº ·¹ÄÚµå´Â DB->set_re_pad ·Î ¼³Á¤µÈ°Í¿¡ ÀÇÇØ ÆеùµÈ´Ù.¼±¾ðµÈ ±æÀ̺¸´ÙÅ« ·¹ÄÚµå´Â ¿¡·¯¸¦ ¹ß»ý½ÃŲ´Ù. backing¼Ò½ºÆÄÀÏ¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ Á¤º¸´Â Flat-text backing filesÂüÁ¶)

¡¡

Record Padding Byte Value

When storing fixed-length records in a Queue or Recno database, a pad character may be specified by calling the DB->set_re_pad method. Any record read from the backing source file or otherwise stored in the database that is shorter than the expected length will automatically be padded with this byte value. If fixed-length records are specified but no pad value is specified, a space character (0x20 in the ASCII character set) will be used. For further information on backing source files, see Flat-text backing files.

(°íÁ¤±æÀÌÀÇ ·¹Äڵ带 Queue or Recno ¿¡ ÀúÀåÇÒ¶§ ÆÐµå ¹®ÀÚ´Â DB->set_re_pad ·Î ¼³Á¤µÉ¼ö ÀÖ´Ù.¼³Á¤µÈ ±æÀ̺¸´Ù ÀÛÀº ·¹ÄÚµå´Â ÀÌ°ªÀ¸·Î ÆеùµÈ´Ù.ƯÁ¤°ªÀÌ ¼³Á¤µÇÁö ¾Ê´Â´Ù¸é ½ºÆäÀ̽º°ª((0x20 in the ASCII character set)ÀÌ »ç¿ëµÈ´Ù.)


PrevRefNext

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.