MySQL 8.0.31
Source Code Documentation
page0cur.ic File Reference

The page cursor. More...

#include "buf0types.h"
#include "page0page.h"
#include "rem0cmp.h"

Functions

static page_tpage_cur_get_page (page_cur_t *cur)
 Gets pointer to the page frame where the cursor is positioned. More...
 
static buf_block_tpage_cur_get_block (page_cur_t *cur)
 Gets pointer to the buffer block where the cursor is positioned. More...
 
static page_zip_des_tpage_cur_get_page_zip (page_cur_t *cur)
 Gets pointer to the page frame where the cursor is positioned. More...
 
static rec_tpage_cur_get_rec (page_cur_t *cur)
 Gets the record where the cursor is positioned. More...
 
static void page_cur_set_before_first (const buf_block_t *block, page_cur_t *cur)
 Sets the cursor object to point before the first user record on the page. More...
 
static void page_cur_set_after_last (const buf_block_t *block, page_cur_t *cur)
 Sets the cursor object to point after the last user record on the page. More...
 
static bool page_cur_is_before_first (const page_cur_t *cur)
 Returns true if the cursor is before first user record on page. More...
 
static bool page_cur_is_after_last (const page_cur_t *cur)
 Returns true if the cursor is after last user record. More...
 
static void page_cur_position (const rec_t *rec, const buf_block_t *block, page_cur_t *cur)
 Positions the cursor on the given record. More...
 
static void page_cur_move_to_next (page_cur_t *cur)
 Moves the cursor to the next record on page. More...
 
static void page_cur_move_to_prev (page_cur_t *cur)
 Moves the cursor to the previous record on page. More...
 
static ulint page_cur_search (const buf_block_t *block, const dict_index_t *index, const dtuple_t *tuple, page_cur_mode_t mode, page_cur_t *cursor)
 Search the right position for a page cursor. More...
 
static ulint page_cur_search (const buf_block_t *block, const dict_index_t *index, const dtuple_t *tuple, page_cur_t *cursor)
 Search the right position for a page cursor. More...
 
static rec_tpage_cur_tuple_insert (page_cur_t *cursor, const dtuple_t *tuple, dict_index_t *index, ulint **offsets, mem_heap_t **heap, mtr_t *mtr)
 
static rec_tpage_cur_tuple_direct_insert (page_cur_t *cursor, const dtuple_t *tuple, dict_index_t *index, mtr_t *mtr, ulint rec_size)
 Insert a record next to page cursor. More...
 
static rec_tpage_cur_rec_insert (page_cur_t *cursor, const rec_t *rec, dict_index_t *index, ulint *offsets, mtr_t *mtr)
 Inserts a record next to page cursor. More...
 

Detailed Description

The page cursor.

Created 10/4/1994 Heikki Tuuri

Function Documentation

◆ page_cur_get_block()

static buf_block_t * page_cur_get_block ( page_cur_t cur)
inlinestatic

Gets pointer to the buffer block where the cursor is positioned.

Returns
page
Parameters
curin: page cursor

◆ page_cur_get_page()

static page_t * page_cur_get_page ( page_cur_t cur)
inlinestatic

Gets pointer to the page frame where the cursor is positioned.

Returns
page
Parameters
curin: page cursor

◆ page_cur_get_page_zip()

static page_zip_des_t * page_cur_get_page_zip ( page_cur_t cur)
inlinestatic

Gets pointer to the page frame where the cursor is positioned.

Returns
page
Parameters
curin: page cursor

◆ page_cur_get_rec()

static rec_t * page_cur_get_rec ( page_cur_t cur)
inlinestatic

Gets the record where the cursor is positioned.

Returns
record
Parameters
curin: page cursor

◆ page_cur_is_after_last()

static bool page_cur_is_after_last ( const page_cur_t cur)
inlinestatic

Returns true if the cursor is after last user record.

Returns
true if at end
Parameters
curin: cursor

◆ page_cur_is_before_first()

static bool page_cur_is_before_first ( const page_cur_t cur)
inlinestatic

Returns true if the cursor is before first user record on page.

Returns
true if at start
Parameters
curin: cursor

◆ page_cur_move_to_next()

static void page_cur_move_to_next ( page_cur_t cur)
inlinestatic

Moves the cursor to the next record on page.

Parameters
curin/out: cursor; must not be after last

◆ page_cur_move_to_prev()

static void page_cur_move_to_prev ( page_cur_t cur)
inlinestatic

Moves the cursor to the previous record on page.

Parameters
curin/out: page cursor, not before first

◆ page_cur_position()

static void page_cur_position ( const rec_t rec,
const buf_block_t block,
page_cur_t cur 
)
inlinestatic

Positions the cursor on the given record.

Parameters
recin: record on a page
blockin: buffer block containing the record
curout: page cursor

◆ page_cur_rec_insert()

static rec_t * page_cur_rec_insert ( page_cur_t cursor,
const rec_t rec,
dict_index_t index,
ulint offsets,
mtr_t mtr 
)
inlinestatic

Inserts a record next to page cursor.

Returns pointer to inserted record if succeed, i.e., enough space available, NULL otherwise. The cursor stays at the same logical position, but the physical position may change if it is pointing to a compressed page that was reorganized.

IMPORTANT: The caller will have to update IBUF_BITMAP_FREE if this is a compressed leaf page in a secondary index. This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit().

Returns
pointer to record if succeed, NULL otherwise
Parameters
cursorin/out: a page cursor
recin: record to insert
indexin: record descriptor
offsetsin/out: rec_get_offsets(rec, index)
mtrin: mini-transaction handle, or NULL

◆ page_cur_search() [1/2]

static ulint page_cur_search ( const buf_block_t block,
const dict_index_t index,
const dtuple_t tuple,
page_cur_mode_t  mode,
page_cur_t cursor 
)
inlinestatic

Search the right position for a page cursor.

Parameters
[in]blockbuffer block
[in]indexindex tree
[in]tupledata tuple
[in]modePAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G, or PAGE_CUR_GE
[out]cursorpage cursor
Returns
number of matched fields on the left

◆ page_cur_search() [2/2]

static ulint page_cur_search ( const buf_block_t block,
const dict_index_t index,
const dtuple_t tuple,
page_cur_t cursor 
)
inlinestatic

Search the right position for a page cursor.

Parameters
[in]blockbuffer block
[in]indexindex tree
[in]tupledata tuple
[out]cursorpage cursor
Returns
number of matched fields on the left

◆ page_cur_set_after_last()

static void page_cur_set_after_last ( const buf_block_t block,
page_cur_t cur 
)
inlinestatic

Sets the cursor object to point after the last user record on the page.

Parameters
blockin: index page
curin: cursor

◆ page_cur_set_before_first()

static void page_cur_set_before_first ( const buf_block_t block,
page_cur_t cur 
)
inlinestatic

Sets the cursor object to point before the first user record on the page.

Parameters
blockin: index page
curin: cursor

◆ page_cur_tuple_direct_insert()

static rec_t * page_cur_tuple_direct_insert ( page_cur_t cursor,
const dtuple_t tuple,
dict_index_t index,
mtr_t mtr,
ulint  rec_size 
)
inlinestatic

Insert a record next to page cursor.

Record is directly copied to the page from tuple without creating intermediate copy of the record.

Parameters
[in,out]cursorA page cursor
[in]tuplePointer to a data tuple
[in]indexRecord descriptor
[in]mtrMini-transaction handle, or NULL
[in]rec_sizeThe size of new record
Returns
pointer to record if succeed, NULL otherwise

◆ page_cur_tuple_insert()

static rec_t * page_cur_tuple_insert ( page_cur_t cursor,
const dtuple_t tuple,
dict_index_t index,
ulint **  offsets,
mem_heap_t **  heap,
mtr_t mtr 
)
inlinestatic