📄 curget.so
字号:
m4_comment([$Id: curget.so,v 10.20 2003/10/18 19:15:52 bostic Exp $])m4_ref_title(Access Methods, Retrieving records with a cursor, [@retrieving records with a cursor, retrieving records with a @cursor], am/cursor, am/curput)m4_p([dnlThe m4_refT(dbc_get) retrieves records from the database using a cursor.The m4_refT(dbc_get) takes a flag which controls how the cursor ispositioned within the database and returns the key/data item associatedwith that positioning. Similar to m4_ref(dbh_get), m4_ref(dbc_get) mayalso take a supplied key and retrieve the data associated with that keyfrom the database. There are several flags that you can set tocustomize retrieval.])m4_section(Cursor position flags)m4_tagbeginm4_tag([m4_ref(DB_FIRST), m4_ref(DB_LAST)], [dnlReturn the first (last) record in the database.])m4_tag([m4_ref(DB_NEXT), m4_ref(DB_PREV)], [dnlReturn the next (previous) record in the database.])m4_tag([m4_ref(DB_NEXT_DUP)], [dnlReturn the next record in the database, if it is a duplicate data itemfor the current key.])m4_tag([m4_ref(DB_NEXT_NODUP), m4_ref(DB_PREV_NODUP)], [dnlReturn the next (previous) record in the database that is not aduplicate data item for the current key.])m4_tag([m4_ref(DB_CURRENT)], [dnlReturn the record from the database to which the cursor currently refers.])m4_tagendm4_section(Retrieving specific key/data pairs)m4_tagbeginm4_tag([m4_ref(DB_SET)], [dnlReturn the record from the database that matches the supplied key. Inthe case of duplicates the first duplicate is returned and the cursoris positioned at the beginning of the duplicate list. The user can thentraverse the duplicate entries for the key.])m4_tag([m4_ref(DB_SET_RANGE)], [dnlReturn the smallest record in the database greater than or equal to thesupplied key. This functionality permits partial key matches and rangesearches in the Btree access method.])m4_tag([m4_ref(DB_GET_BOTH)], [dnlReturn the record from the database that matches both the supplied keyand data items. This is particularly useful when there are largenumbers of duplicate records for a key, as it allows the cursor toeasily be positioned at the correct place for traversal of some part ofa large set of duplicate records.])m4_tag([m4_ref(DB_GET_BOTH_RANGE)], [dnlReturn the smallest record in the database greater than or equal to thesupplied key and data items.])m4_tagendm4_section(Retrieving based on record numbers)m4_tagbeginm4_tag([m4_ref(DB_SET_RECNO)], [dnlIf the underlying database is a Btree, and was configured so that it ispossible to search it by logical record number, retrieve a specificrecord based on a record number argument.])m4_tag([m4_ref(DB_GET_RECNO)], [dnlIf the underlying database is a Btree, and was configured so that it ispossible to search it by logical record number, return the record numberfor the record to which the cursor refers.])m4_tagendm4_section(Special-purpose flags)m4_tagbeginm4_tag([m4_ref(DB_CONSUME)], [dnlRead-and-delete: the first record (the head) of the queue is returned anddeleted. The underlying database must be a Queue.])m4_tag([m4_ref(DB_RMW)], [dnlRead-modify-write: acquire write locks instead of read locks duringretrieval. This can enhance performance in threaded applications byreducing the chance of deadlock.])m4_tagendm4_p([dnlIn all cases, the cursor is repositioned by a m4_ref(dbc_get) operationto point to the newly-returned key/data pair in the database.])m4_p([dnlThe following is a code example showing a cursor walking through adatabase and displaying the records it contains to the standardoutput:])include(ref/am/curget.cs)m4_page_footer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -