|
![]() ![]()
|
Records stored in the Queue and Recno access methods are accessed by logical record number. In all cases in Btree databases, and optionally in Recno databases (see the DB->set_flags method and the DB_RENUMBER flag for more information), record numbers are mutable. This means that the record numbers may change as records are added to and deleted from the database. The deletion of record number 4 causes any records numbered 5 and higher to be renumbered downward by 1; the addition of a new record after record number 4 causes any records numbered 5 and higher to be renumbered upward by 1. In all cases in Queue databases, and by default in Recno databases, record numbers are not mutable, and the addition or deletion of records to the database will not cause already-existing record numbers to change. For this reason, new records cannot be inserted between already-existing records in databases with immutable record numbers.
(Queue and Recno 에 저장된 레코드는 논리적인 레코드번호로 액세스된다.Btree 와 선택적 Recno ( DB->set_flags method and the DB_RENUMBER 참조)의 레코드 번호는 가변적이다.이것이 의미하는 것은 레코드번호는 레코드가 추가,삭제될때 변경될 수 있다는 것이다.레코드번호 4의 삭제는 4이상의 레코드들의 번호를 1씩 감소시킨다.또한 레코드4뒤에 새로 레코드를 삽입하면 4이후 레코드들의 레코드번호는 1씩 증가한다.Recno의 디폴트 레코드번호는 변경가능하지 않다.추가적인 삽입,삭제는 기존의 레코드드의 레코드번호를 변경시키지 않느다.이러한 이유로 새로운 레코드는 기존의 레코드사이에 삽입될수 없다.)
Cursors pointing into a Btree database or a Recno database with mutable record numbers maintain a reference to a specific record, rather than a record number, that is, the record they reference does not change as other records are added or deleted. For example, if a database contains three records with the record numbers 1, 2, and 3, and the data items "A", "B", and "C", respectively, the deletion of record number 2 ("B") will cause the record "C" to be renumbered downward to record number 2. A cursor positioned at record number 3 ("C") will be adjusted and continue to point to "C" after the deletion. Similarly, a cursor previously referring to the now deleted record number 2 will be positioned between the new record numbers 1 and 2, and an insertion using that cursor will appear between those records. In this manner records can be added and deleted to a database without disrupting the sequential traversal of the database by a cursor.
(커서는 Btree와 Recno를 (특정한 레코드를 유지하는 가변적인 레코드번호)로 가르킨다.즉 다른 레코드의 추가,삭제때 참조하는 레코드는 변경되지 않는다.예를들어 디비가 레코드번호1,2,3인 세개의 레코드를 가지고 있고 각 데이타아이템이 "A","B","C"일때 레코드번호2의 삭제는 "C"의 레코드번호를 2로 변경시키게 된다.레코드 번호 3("C")를 가르키고 있던 커서는 조정되고 삭제후에도 계속 "C"를 가르키게 된다.
Only cursors created using a single DB handle can adjust each other's position in this way, however. If multiple DB handles have a renumbering Recno database open simultaneously (as when multiple processes share a single database environment), a record referred to by one cursor could change underfoot if a cursor created using another DB handle inserts or deletes records into the database. For this reason, applications using Recno databases with mutable record numbers will usually make all accesses to the database using a single DB handle and cursors created from that handle, or will otherwise single-thread access to the database, for example, by using the Berkeley DB Concurrent Data Store product.
(오직 단일 DB핸들을 사용하여 생성된 커서들만이 서로다른 위치로 조정될 수 있다.그러나 멀티 DB핸들이 동시에 열린(여러 프로세스가 단일 디비를 공유) Recno디비를 재넘버링 했을때 하나의 커서에 의해 참조되는 레코드만이 다른 DB핸들에 의해 만들어진 커서가 레코드의 삽입,삭제될때 변경된다.이와같은 이유로 가변적 레코드 Recno디비를 사용하는 애플리케이션은 싱글 디비 핸들러와 이 디비핸들러부터 생성된 커서를 사용하거나 디비에 엑세스하는 싱글쓰레드를 사용한다)
In any Queue or Recno databases, creating new records will cause the creation of multiple records if the record number being created is more than one greater than the largest record currently in the database. For example, creating record number 28, when record 25 was previously the last record in the database, will implicitly create records 26 and 27 as well as 28. All first, last, next and previous cursor operations will automatically skip over these implicitly created records. So, if record number 5 is the only record the application has created, implicitly creating records 1 through 4, the DBcursor->c_get method with the DB_FIRST flag will return record number 5, not record number 1. Attempts to explicitly retrieve implicitly created records by their record number will result in a special error return, DB_KEYEMPTY.
(Queue or Recno databases에서 새로운 레코드들을 생성은 현재가장큰 레코드보다 큰 레코드넘버가 생성된다면 여러 멀티플 레코드가 생성된다.예를들어 마지막레코드가 25일때 레코드번호28을 생성하는 것은 암시적으로 레코드 26.27또한 생성한다.커서오퍼레이션은 이 암시적으로 생성된 레코드를 스킵한다.그래서 만약 레코드번호5가 애플리케이션이 생성한 유일한 레코드이면 암시적으로 1~4의 레코드도 생성되고 DBcursor->c_get method (DB_FIRST flag)는 레코드번호1이 아닌 레코드번호 5를 리턴한다.이 암시적으로 생성된 레코드를 명시적으로 리트리빙하면 에러(DB_KEYEMPTY.)가 발생한다)
In any Berkeley DB database, attempting to retrieve a deleted record, using a cursor positioned on the record, results in a special error return, DB_KEYEMPTY. In addition, when using Queue databases or Recno databases with immutable record numbers, attempting to retrieve a deleted record by its record number will also result in the DB_KEYEMPTY return.
(버클리디비에서 삭제된 레코드를 삭제된 레코드를 가르키는 커서를 사용하여 리트리빙하면 DB_KEYEMPTY에러가 발생한다.추가적으로 고정크기의 Queue or Recno를 사용할때 삭제된 레코드를 그 레코드번호로 리트리빙하면 또한 DB_KEYEMPTY가 발생한다.)
![]() ![]()
|
Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.