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.

(예를들어,유닉스 텍스트파일은 뉴라인 캐릭터에 의해 구별되는 가변길의 레코드의 연속으로 해석될수 있다.이 바이트값(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.