1
/************************************************************************
4
(c) 1994-1996 Innobase Oy
6
Created 10/4/1994 Heikki Tuuri
7
*************************************************************************/
12
/*************************************************************
13
Gets pointer to the page frame where the cursor is positioned. */
19
page_cur_t* cur) /* in: page cursor */
23
return(buf_frame_align(cur->rec));
26
/*************************************************************
27
Gets the record where the cursor is positioned. */
33
page_cur_t* cur) /* in: page cursor */
40
/*************************************************************
41
Sets the cursor object to point before the first user record
45
page_cur_set_before_first(
46
/*======================*/
47
page_t* page, /* in: index page */
48
page_cur_t* cur) /* in: cursor */
50
cur->rec = page_get_infimum_rec(page);
53
/*************************************************************
54
Sets the cursor object to point after the last user record on
58
page_cur_set_after_last(
59
/*====================*/
60
page_t* page, /* in: index page */
61
page_cur_t* cur) /* in: cursor */
63
cur->rec = page_get_supremum_rec(page);
66
/*************************************************************
67
Returns TRUE if the cursor is before first user record on page. */
70
page_cur_is_before_first(
71
/*=====================*/
72
/* out: TRUE if at start */
73
const page_cur_t* cur) /* in: cursor */
75
return(page_rec_is_infimum(cur->rec));
78
/*************************************************************
79
Returns TRUE if the cursor is after last user record. */
82
page_cur_is_after_last(
83
/*===================*/
84
/* out: TRUE if at end */
85
const page_cur_t* cur) /* in: cursor */
87
return(page_rec_is_supremum(cur->rec));
90
/**************************************************************
91
Positions the cursor on the given record. */
96
rec_t* rec, /* in: record on a page */
97
page_cur_t* cur) /* in: page cursor */
104
/**************************************************************
105
Invalidates a page cursor by setting the record pointer NULL. */
110
page_cur_t* cur) /* in: page cursor */
117
/**************************************************************
118
Moves the cursor to the next record on page. */
121
page_cur_move_to_next(
122
/*==================*/
123
page_cur_t* cur) /* in: cursor; must not be after last */
125
ut_ad(!page_cur_is_after_last(cur));
127
cur->rec = page_rec_get_next(cur->rec);
130
/**************************************************************
131
Moves the cursor to the previous record on page. */
134
page_cur_move_to_prev(
135
/*==================*/
136
page_cur_t* cur) /* in: page cursor, not before first */
138
ut_ad(!page_cur_is_before_first(cur));
140
cur->rec = page_rec_get_prev(cur->rec);
143
/********************************************************************
144
Searches the right position for a page cursor. */
149
/* out: number of matched fields on the left */
150
page_t* page, /* in: index page */
151
dict_index_t* index, /* in: record descriptor */
152
dtuple_t* tuple, /* in: data tuple */
153
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
155
page_cur_t* cursor) /* out: page cursor */
157
ulint low_matched_fields = 0;
158
ulint low_matched_bytes = 0;
159
ulint up_matched_fields = 0;
160
ulint up_matched_bytes = 0;
162
ut_ad(dtuple_check_typed(tuple));
164
page_cur_search_with_match(page, index, tuple, mode,
170
return(low_matched_fields);
173
/***************************************************************
174
Inserts a record next to page cursor. Returns pointer to inserted record if
175
succeed, i.e., enough space available, NULL otherwise. The cursor stays at
176
the same position. */
179
page_cur_tuple_insert(
180
/*==================*/
181
/* out: pointer to record if succeed, NULL
183
page_cur_t* cursor, /* in: a page cursor */
184
dtuple_t* tuple, /* in: pointer to a data tuple */
185
dict_index_t* index, /* in: record descriptor */
186
mtr_t* mtr) /* in: mini-transaction handle */
188
return(page_cur_insert_rec_low(cursor, tuple, index, NULL, NULL, mtr));
191
/***************************************************************
192
Inserts a record next to page cursor. Returns pointer to inserted record if
193
succeed, i.e., enough space available, NULL otherwise. The cursor stays at
194
the same position. */
199
/* out: pointer to record if succeed, NULL
201
page_cur_t* cursor, /* in: a page cursor */
202
rec_t* rec, /* in: record to insert */
203
dict_index_t* index, /* in: record descriptor */
204
ulint* offsets,/* in: rec_get_offsets(rec, index) */
205
mtr_t* mtr) /* in: mini-transaction handle */
207
return(page_cur_insert_rec_low(cursor, NULL, index, rec,