📄 renumber.so
字号:
m4_comment([$Id: renumber.so,v 10.26 2003/10/18 19:15:55 bostic Exp $])m4_ref_title(Access Methods, Logically renumbering records, logically renumbering @records, am_conf/re_source, am/ops)m4_p([dnlRecords stored in the Queue and Recno access methods are accessed bylogical record number. In all cases in Btree databases, and optionallyin Recno databases (see the m4_refT(dbh_set_flags) and them4_ref(DB_RENUMBER) flag for more information), record numbers aremutable. This means that the record numbers may change as records areadded to and deleted from the database. The deletion of record number4 causes any records numbered 5 and higher to be renumbered downward by1; the addition of a new record after record number 4 causes anyrecords numbered 5 and higher to be renumbered upward by 1. In allcases in Queue databases, and by default in Recno databases, recordnumbers are not mutable, and the addition or deletion of records to thedatabase will not cause already-existing record numbers to change. Forthis reason, new records cannot be inserted between already-existingrecords in databases with immutable record numbers.])m4_p([dnlCursors pointing into a Btree database or a Recno database with mutablerecord numbers maintain a reference to a specific record, rather thana record number, that is, the record they reference does not change asother records are added or deleted. For example, if a database containsthree 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 andcontinue to point to "C" after the deletion. Similarly, a cursorpreviously referring to the now deleted record number 2 will bepositioned between the new record numbers 1 and 2, and an insertionusing that cursor will appear between those records. In this mannerrecords can be added and deleted to a database without disrupting thesequential traversal of the database by a cursor.])m4_p([dnlOnly cursors created using a single m4_ref(Db) handle can adjust eachother's position in this way, however. If multiple m4_ref(Db) handleshave a renumbering Recno database open simultaneously (as when multipleprocesses share a single database environment), a record referred to byone cursor could change underfoot if a cursor created using anotherm4_ref(Db) handle inserts or deletes records into the database. Forthis reason, applications using Recno databases with mutable recordnumbers will usually make all accesses to the database using a singlem4_ref(Db) handle and cursors created from that handle, or willotherwise single-thread access to the database, for example, by usingthe m4_cam product.])m4_p([dnlIn any Queue or Recno databases, creating new records will cause thecreation of multiple records if the record number being created is morethan one greater than the largest record currently in the database. Forexample, creating record number 28, when record 25 was previously thelast record in the database, will implicitly create records 26 and 27as well as 28. All first, last, next and previous cursor operationswill automatically skip over these implicitly created records. So, ifrecord number 5 is the only record the application has created,implicitly creating records 1 through 4, the m4_refT(dbc_get) with them4_ref(DB_FIRST) flag will return record number 5, not record number 1.Attempts to explicitly retrieve implicitly created records by theirrecord number will result in a special error return,m4_ref(DB_KEYEMPTY).])m4_p([dnlIn any m4_db database, attempting to retrieve a deleted record, usinga cursor positioned on the record, results in a special error return,m4_ref(DB_KEYEMPTY). In addition, when using Queue databases or Recnodatabases with immutable record numbers, attempting to retrieve a deletedrecord by its record number will also result in the m4_ref(DB_KEYEMPTY)return.])m4_page_footer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -