Macros |
#define | BTR_PCUR_ON 1 |
#define | BTR_PCUR_BEFORE 2 |
#define | BTR_PCUR_AFTER 3 |
#define | BTR_PCUR_BEFORE_FIRST_IN_TREE 4 /* in an empty tree */ |
#define | BTR_PCUR_AFTER_LAST_IN_TREE 5 /* in an empty tree */ |
#define | btr_pcur_open(i, t, md, l, c, m) btr_pcur_open_low(i,0,t,md,l,c,__FILE__,__LINE__,m) |
#define | btr_pcur_open_with_no_init(ix, t, md, l, cur, has, m) btr_pcur_open_with_no_init_func(ix,t,md,l,cur,has,__FILE__,__LINE__,m) |
#define | btr_pcur_open_on_user_rec(i, t, md, l, c, m) btr_pcur_open_on_user_rec_func(i,t,md,l,c,__FILE__,__LINE__,m) |
#define | btr_pcur_open_at_rnd_pos(i, l, c, m) btr_pcur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m) |
#define | btr_pcur_restore_position(l, cur, mtr) btr_pcur_restore_position_func(l,cur,__FILE__,__LINE__,mtr) |
#define | btr_pcur_get_btr_cur(cursor) (&(cursor)->btr_cur) |
#define | btr_pcur_get_page_cur(cursor) (&(cursor)->btr_cur.page_cur) |
#define | btr_pcur_get_page(cursor) ((cursor)->btr_cur.page_cur.block->frame) |
#define | btr_pcur_get_block(cursor) ((cursor)->btr_cur.page_cur.block) |
#define | btr_pcur_get_rec(cursor) ((cursor)->btr_cur.page_cur.rec) |
#define | BTR_PCUR_IS_POSITIONED |
#define | BTR_PCUR_WAS_POSITIONED 1187549791 |
#define | BTR_PCUR_NOT_POSITIONED 1328997689 |
#define | BTR_PCUR_OLD_STORED 908467085 |
#define | BTR_PCUR_OLD_NOT_STORED 122766467 |
Functions |
UNIV_INTERN btr_pcur_t * | btr_pcur_create_for_mysql (void) |
UNIV_INTERN void | btr_pcur_reset (btr_pcur_t *cursor) |
UNIV_INTERN void | btr_pcur_free_for_mysql (btr_pcur_t *cursor) |
UNIV_INTERN void | btr_pcur_copy_stored_position (btr_pcur_t *pcur_receive, btr_pcur_t *pcur_donate) |
UNIV_INLINE void | btr_pcur_init (btr_pcur_t *pcur) |
UNIV_INLINE void | btr_pcur_open_low (dict_index_t *index, ulint level, const dtuple_t *tuple, ulint mode, ulint latch_mode, btr_pcur_t *cursor, const char *file, ulint line, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_open_with_no_init_func (dict_index_t *index, const dtuple_t *tuple, ulint mode, ulint latch_mode, btr_pcur_t *cursor, ulint has_search_latch, const char *file, ulint line, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_open_at_index_side (bool from_left, dict_index_t *index, ulint latch_mode, btr_pcur_t *pcur, bool init_pcur, ulint level, mtr_t *mtr) __attribute__((nonnull)) |
UNIV_INLINE ulint | btr_pcur_get_up_match (const btr_pcur_t *cursor) |
UNIV_INLINE ulint | btr_pcur_get_low_match (const btr_pcur_t *cursor) |
UNIV_INTERN void | btr_pcur_open_on_user_rec_func (dict_index_t *index, const dtuple_t *tuple, ulint mode, ulint latch_mode, btr_pcur_t *cursor, const char *file, ulint line, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_open_at_rnd_pos_func (dict_index_t *index, ulint latch_mode, btr_pcur_t *cursor, const char *file, ulint line, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_close (btr_pcur_t *cursor) |
UNIV_INTERN void | btr_pcur_store_position (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INTERN ibool | btr_pcur_restore_position_func (ulint latch_mode, btr_pcur_t *cursor, const char *file, ulint line, mtr_t *mtr) |
UNIV_INLINE ulint | btr_pcur_get_rel_pos (const btr_pcur_t *cursor) |
UNIV_INLINE void | btr_pcur_commit_specify_mtr (btr_pcur_t *pcur, mtr_t *mtr) |
UNIV_INLINE ibool | btr_pcur_move_to_next (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INTERN ibool | btr_pcur_move_to_prev (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_move_to_last_on_page (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE ibool | btr_pcur_move_to_next_user_rec (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INTERN void | btr_pcur_move_to_next_page (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INTERN void | btr_pcur_move_backward_from_page (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE ibool | btr_pcur_is_on_user_rec (const btr_pcur_t *cursor) |
UNIV_INLINE ibool | btr_pcur_is_after_last_on_page (const btr_pcur_t *cursor) |
UNIV_INLINE ibool | btr_pcur_is_before_first_on_page (const btr_pcur_t *cursor) |
UNIV_INLINE ibool | btr_pcur_is_before_first_in_tree (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE ibool | btr_pcur_is_after_last_in_tree (btr_pcur_t *cursor, mtr_t *mtr) |
UNIV_INLINE void | btr_pcur_move_to_next_on_page (btr_pcur_t *cursor) |
UNIV_INLINE void | btr_pcur_move_to_prev_on_page (btr_pcur_t *cursor) |
The index tree persistent cursor
Created 2/23/1996 Heikki Tuuri
Definition in file btr0pcur.h.
UNIV_INTERN void btr_pcur_move_backward_from_page |
( |
btr_pcur_t * |
cursor, |
|
|
mtr_t * |
mtr |
|
) |
| |
Moves the persistent cursor backward if it is on the first record of the page. Releases the latch on the current page, and bufferunfixes it. Note that to prevent a possible deadlock, the operation first stores the position of the cursor, releases the leaf latch, acquires necessary latches and restores the cursor position again before returning. The alphabetical position of the cursor is guaranteed to be sensible on return, but it may happen that the cursor is not positioned on the last record of any page, because the structure of the tree may have changed while the cursor had no latches. in: mtr
Moves the persistent cursor backward if it is on the first record of the page. Commits mtr. Note that to prevent a possible deadlock, the operation first stores the position of the cursor, commits mtr, acquires the necessary latches and restores the cursor position again before returning. The alphabetical position of the cursor is guaranteed to be sensible on return, but it may happen that the cursor is not positioned on the last record of any page, because the structure of the tree may have changed during the time when the cursor had no latches.
- Parameters
-
cursor | in: persistent cursor, must be on the first record of the current page |
mtr | in: mtr |
Definition at line 462 of file btr0pcur.cc.
UNIV_INTERN void btr_pcur_move_to_next_page |
( |
btr_pcur_t * |
cursor, |
|
|
mtr_t * |
mtr |
|
) |
| |
Moves the persistent cursor to the first record on the next page. Releases the latch on the current page, and bufferunfixes it. Note that there must not be modifications on the current page, as then the x-latch can be released only in mtr_commit. in: mtr
Moves the persistent cursor to the first record on the next page. Releases the latch on the current page, and bufferunfixes it. Note that there must not be modifications on the current page, as then the x-latch can be released only in mtr_commit.
- Parameters
-
cursor | in: persistent cursor; must be on the last record of the current page |
mtr | in: mtr |
Definition at line 406 of file btr0pcur.cc.
UNIV_INTERN void btr_pcur_open_on_user_rec_func |
( |
dict_index_t * |
index, |
|
|
const dtuple_t * |
tuple, |
|
|
ulint |
mode, |
|
|
ulint |
latch_mode, |
|
|
btr_pcur_t * |
cursor, |
|
|
const char * |
file, |
|
|
ulint |
line, |
|
|
mtr_t * |
mtr |
|
) |
| |
If mode is PAGE_CUR_G or PAGE_CUR_GE, opens a persistent cursor on the first user record satisfying the search condition, in the case PAGE_CUR_L or PAGE_CUR_LE, on the last user record. If no such user record exists, then in the first case sets the cursor after last in tree, and in the latter case before first in tree. The latching mode must be BTR_SEARCH_LEAF or BTR_MODIFY_LEAF. in: mtr
If mode is PAGE_CUR_G or PAGE_CUR_GE, opens a persistent cursor on the first user record satisfying the search condition, in the case PAGE_CUR_L or PAGE_CUR_LE, on the last user record. If no such user record exists, then in the first case sets the cursor after last in tree, and in the latter case before first in tree. The latching mode must be BTR_SEARCH_LEAF or BTR_MODIFY_LEAF.
- Parameters
-
index | in: index |
tuple | in: tuple on which search done |
mode | in: PAGE_CUR_L, ... |
latch_mode | in: BTR_SEARCH_LEAF or BTR_MODIFY_LEAF |
cursor | in: memory buffer for persistent cursor |
file | in: file name |
line | in: line where called |
mtr | in: mtr |
Definition at line 574 of file btr0pcur.cc.
UNIV_INTERN void btr_pcur_reset |
( |
btr_pcur_t * |
cursor | ) |
|
Resets a persistent cursor object, freeing ::old_rec_buf if it is allocated and resetting the other members to their initial values. in, out: persistent cursor
Resets a persistent cursor object, freeing ::old_rec_buf if it is allocated and resetting the other members to their initial values.
- Parameters
-
cursor | in, out: persistent cursor |
Definition at line 59 of file btr0pcur.cc.
UNIV_INTERN ibool btr_pcur_restore_position_func |
( |
ulint |
latch_mode, |
|
|
btr_pcur_t * |
cursor, |
|
|
const char * |
file, |
|
|
ulint |
line, |
|
|
mtr_t * |
mtr |
|
) |
| |
Restores the stored position of a persistent cursor bufferfixing the page and obtaining the specified latches. If the cursor position was saved when the (1) cursor was positioned on a user record: this function restores the position to the last record LESS OR EQUAL to the stored record; (2) cursor was positioned on a page infimum record: restores the position to the last record LESS than the user record which was the successor of the page infimum; (3) cursor was positioned on the page supremum: restores to the first record GREATER than the user record which was the predecessor of the supremum. (4) cursor was positioned before the first or after the last in an empty tree: restores to before first or after the last in the tree.
- Returns
- TRUE if the cursor position was stored when it was on a user record and it can be restored on a user record whose ordering fields are identical to the ones of the original user record in: mtr
Restores the stored position of a persistent cursor bufferfixing the page and obtaining the specified latches. If the cursor position was saved when the (1) cursor was positioned on a user record: this function restores the position to the last record LESS OR EQUAL to the stored record; (2) cursor was positioned on a page infimum record: restores the position to the last record LESS than the user record which was the successor of the page infimum; (3) cursor was positioned on the page supremum: restores to the first record GREATER than the user record which was the predecessor of the supremum. (4) cursor was positioned before the first or after the last in an empty tree: restores to before first or after the last in the tree.
- Returns
- TRUE if the cursor position was stored when it was on a user record and it can be restored on a user record whose ordering fields are identical to the ones of the original user record
- Parameters
-
latch_mode | in: BTR_SEARCH_LEAF, ... |
cursor | in: detached persistent cursor |
file | in: file name |
line | in: line where called |
mtr | in: mtr |
Definition at line 223 of file btr0pcur.cc.
UNIV_INTERN void btr_pcur_store_position |
( |
btr_pcur_t * |
cursor, |
|
|
mtr_t * |
mtr |
|
) |
| |
The position of the cursor is stored by taking an initial segment of the record the cursor is positioned on, before, or after, and copying it to the cursor data structure, or just setting a flag if the cursor id before the first in an EMPTY tree, or after the last in an EMPTY tree. NOTE that the page where the cursor is positioned must not be empty if the index tree is not totally empty! in: mtr
The position of the cursor is stored by taking an initial segment of the record the cursor is positioned on, before, or after, and copying it to the cursor data structure, or just setting a flag if the cursor id before the first in an EMPTY tree, or after the last in an EMPTY tree. NOTE that the page where the cursor is positioned must not be empty if the index tree is not totally empty!
- Parameters
-
cursor | in: persistent cursor |
mtr | in: mtr |
Definition at line 101 of file btr0pcur.cc.