MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
btr0pcur.h
Go to the documentation of this file.
1
/*****************************************************************************
2
3
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
4
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
8
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc.,
15
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16
17
*****************************************************************************/
18
19
/**************************************************/
26
#ifndef btr0pcur_h
27
#define btr0pcur_h
28
29
#include "univ.i"
30
#include "
dict0dict.h
"
31
#include "
data0data.h
"
32
#include "
mtr0mtr.h
"
33
#include "
page0cur.h
"
34
#include "
btr0cur.h
"
35
#include "
btr0btr.h
"
36
#include "
btr0types.h
"
37
38
/* Relative positions for a stored cursor position */
39
#define BTR_PCUR_ON 1
40
#define BTR_PCUR_BEFORE 2
41
#define BTR_PCUR_AFTER 3
42
/* Note that if the tree is not empty, btr_pcur_store_position does not
43
use the following, but only uses the above three alternatives, where the
44
position is stored relative to a specific record: this makes implementation
45
of a scroll cursor easier */
46
#define BTR_PCUR_BEFORE_FIRST_IN_TREE 4
/* in an empty tree */
47
#define BTR_PCUR_AFTER_LAST_IN_TREE 5
/* in an empty tree */
48
49
/**************************************************************/
52
UNIV_INTERN
53
btr_pcur_t
*
54
btr_pcur_create_for_mysql
(
void
);
55
/*============================*/
56
57
/**************************************************************/
60
UNIV_INTERN
61
void
62
btr_pcur_reset
(
63
/*===========*/
64
btr_pcur_t
*
cursor
);
66
/**************************************************************/
68
UNIV_INTERN
69
void
70
btr_pcur_free_for_mysql
(
71
/*====================*/
72
btr_pcur_t
*
cursor
);
73
/**************************************************************/
75
UNIV_INTERN
76
void
77
btr_pcur_copy_stored_position
(
78
/*==========================*/
79
btr_pcur_t
* pcur_receive,
81
btr_pcur_t
* pcur_donate);
83
/**************************************************************/
85
UNIV_INLINE
86
void
87
btr_pcur_init
(
88
/*==========*/
89
btr_pcur_t
*
pcur
);
90
/**************************************************************/
93
UNIV_INLINE
94
void
95
btr_pcur_open_low
(
96
/*==============*/
97
dict_index_t
*
index
,
98
ulint
level
,
99
const
dtuple_t
*
tuple
,
100
ulint
mode
,
106
ulint latch_mode,
107
btr_pcur_t
*
cursor
,
108
const
char
*
file
,
109
ulint line,
110
mtr_t
*
mtr
);
111
#define btr_pcur_open(i,t,md,l,c,m) \
112
btr_pcur_open_low(i,0,t,md,l,c,__FILE__,__LINE__,m)
113
/**************************************************************/
116
UNIV_INLINE
117
void
118
btr_pcur_open_with_no_init_func
(
119
/*============================*/
120
dict_index_t
*
index
,
121
const
dtuple_t
*
tuple
,
122
ulint
mode
,
128
ulint latch_mode,
133
btr_pcur_t
*
cursor
,
134
ulint has_search_latch,
137
const
char
*
file
,
138
ulint line,
139
mtr_t
*
mtr
);
140
#define btr_pcur_open_with_no_init(ix,t,md,l,cur,has,m) \
141
btr_pcur_open_with_no_init_func(ix,t,md,l,cur,has,__FILE__,__LINE__,m)
142
143
/*****************************************************************/
145
UNIV_INLINE
146
void
147
btr_pcur_open_at_index_side
(
148
/*========================*/
149
bool
from_left,
151
dict_index_t
*
index
,
152
ulint latch_mode,
153
btr_pcur_t
*
pcur
,
154
bool
init_pcur,
155
ulint
level
,
157
mtr_t
*
mtr
)
158
__attribute__((nonnull));
159
/**************************************************************/
163
UNIV_INLINE
164
ulint
165
btr_pcur_get_up_match
(
166
/*==================*/
167
const
btr_pcur_t
*
cursor
);
168
/**************************************************************/
172
UNIV_INLINE
173
ulint
174
btr_pcur_get_low_match
(
175
/*===================*/
176
const
btr_pcur_t
*
cursor
);
177
/**************************************************************/
184
UNIV_INTERN
185
void
186
btr_pcur_open_on_user_rec_func
(
187
/*===========================*/
188
dict_index_t
*
index
,
189
const
dtuple_t
*
tuple
,
190
ulint
mode
,
191
ulint latch_mode,
193
btr_pcur_t
*
cursor
,
195
const
char
*
file
,
196
ulint line,
197
mtr_t
*
mtr
);
198
#define btr_pcur_open_on_user_rec(i,t,md,l,c,m) \
199
btr_pcur_open_on_user_rec_func(i,t,md,l,c,__FILE__,__LINE__,m)
200
/**********************************************************************/
202
UNIV_INLINE
203
void
204
btr_pcur_open_at_rnd_pos_func
(
205
/*==========================*/
206
dict_index_t
*
index
,
207
ulint latch_mode,
208
btr_pcur_t
*
cursor
,
209
const
char
*
file
,
210
ulint line,
211
mtr_t
*
mtr
);
212
#define btr_pcur_open_at_rnd_pos(i,l,c,m) \
213
btr_pcur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m)
214
/**************************************************************/
226
UNIV_INLINE
227
void
228
btr_pcur_close
(
229
/*===========*/
230
btr_pcur_t
*
cursor
);
231
/**************************************************************/
238
UNIV_INTERN
239
void
240
btr_pcur_store_position
(
241
/*====================*/
242
btr_pcur_t
*
cursor
,
243
mtr_t
*
mtr
);
244
/**************************************************************/
259
UNIV_INTERN
260
ibool
261
btr_pcur_restore_position_func
(
262
/*===========================*/
263
ulint latch_mode,
264
btr_pcur_t
*
cursor
,
265
const
char
*
file
,
266
ulint line,
267
mtr_t
*
mtr
);
268
#define btr_pcur_restore_position(l,cur,mtr) \
269
btr_pcur_restore_position_func(l,cur,__FILE__,__LINE__,mtr)
270
/*********************************************************/
273
UNIV_INLINE
274
ulint
275
btr_pcur_get_rel_pos
(
276
/*=================*/
277
const
btr_pcur_t
*
cursor
);
278
/**************************************************************/
283
UNIV_INLINE
284
void
285
btr_pcur_commit_specify_mtr
(
286
/*========================*/
287
btr_pcur_t
*
pcur
,
288
mtr_t
*
mtr
);
289
/*********************************************************/
293
UNIV_INLINE
294
ibool
295
btr_pcur_move_to_next
(
296
/*==================*/
297
btr_pcur_t
*
cursor
,
299
mtr_t
*
mtr
);
300
/*********************************************************/
304
UNIV_INTERN
305
ibool
306
btr_pcur_move_to_prev
(
307
/*==================*/
308
btr_pcur_t
*
cursor
,
310
mtr_t
*
mtr
);
311
/*********************************************************/
313
UNIV_INLINE
314
void
315
btr_pcur_move_to_last_on_page
(
316
/*==========================*/
317
btr_pcur_t
*
cursor
,
318
mtr_t
*
mtr
);
319
/*********************************************************/
323
UNIV_INLINE
324
ibool
325
btr_pcur_move_to_next_user_rec
(
326
/*===========================*/
327
btr_pcur_t
*
cursor
,
329
mtr_t
*
mtr
);
330
/*********************************************************/
335
UNIV_INTERN
336
void
337
btr_pcur_move_to_next_page
(
338
/*=======================*/
339
btr_pcur_t
*
cursor
,
341
mtr_t
*
mtr
);
342
/*********************************************************/
352
UNIV_INTERN
353
void
354
btr_pcur_move_backward_from_page
(
355
/*=============================*/
356
btr_pcur_t
*
cursor
,
358
mtr_t
*
mtr
);
359
#ifdef UNIV_DEBUG
360
/*********************************************************/
363
UNIV_INLINE
364
btr_cur_t
*
365
btr_pcur_get_btr_cur(
366
/*=================*/
367
const
btr_pcur_t
*
cursor
);
368
/*********************************************************/
371
UNIV_INLINE
372
page_cur_t
*
373
btr_pcur_get_page_cur(
374
/*==================*/
375
const
btr_pcur_t
*
cursor
);
376
/*********************************************************/
379
UNIV_INLINE
380
page_t
*
381
btr_pcur_get_page(
382
/*==============*/
383
const
btr_pcur_t
*
cursor
);
384
/*********************************************************/
387
UNIV_INLINE
388
buf_block_t
*
389
btr_pcur_get_block(
390
/*===============*/
391
const
btr_pcur_t
*
cursor
);
392
/*********************************************************/
395
UNIV_INLINE
396
rec_t*
397
btr_pcur_get_rec(
398
/*=============*/
399
const
btr_pcur_t
*
cursor
);
400
#else
/* UNIV_DEBUG */
401
# define btr_pcur_get_btr_cur(cursor) (&(cursor)->btr_cur)
402
# define btr_pcur_get_page_cur(cursor) (&(cursor)->btr_cur.page_cur)
403
# define btr_pcur_get_page(cursor) ((cursor)->btr_cur.page_cur.block->frame)
404
# define btr_pcur_get_block(cursor) ((cursor)->btr_cur.page_cur.block)
405
# define btr_pcur_get_rec(cursor) ((cursor)->btr_cur.page_cur.rec)
406
#endif
/* UNIV_DEBUG */
407
/*********************************************************/
409
UNIV_INLINE
410
ibool
411
btr_pcur_is_on_user_rec
(
412
/*====================*/
413
const
btr_pcur_t
*
cursor
);
414
/*********************************************************/
417
UNIV_INLINE
418
ibool
419
btr_pcur_is_after_last_on_page
(
420
/*===========================*/
421
const
btr_pcur_t
*
cursor
);
422
/*********************************************************/
425
UNIV_INLINE
426
ibool
427
btr_pcur_is_before_first_on_page
(
428
/*=============================*/
429
const
btr_pcur_t
*
cursor
);
430
/*********************************************************/
433
UNIV_INLINE
434
ibool
435
btr_pcur_is_before_first_in_tree
(
436
/*=============================*/
437
btr_pcur_t
*
cursor
,
438
mtr_t
*
mtr
);
439
/*********************************************************/
442
UNIV_INLINE
443
ibool
444
btr_pcur_is_after_last_in_tree
(
445
/*===========================*/
446
btr_pcur_t
*
cursor
,
447
mtr_t
*
mtr
);
448
/*********************************************************/
450
UNIV_INLINE
451
void
452
btr_pcur_move_to_next_on_page
(
453
/*==========================*/
454
btr_pcur_t
*
cursor
);
455
/*********************************************************/
457
UNIV_INLINE
458
void
459
btr_pcur_move_to_prev_on_page
(
460
/*==========================*/
461
btr_pcur_t
*
cursor
);
464
/* The persistent B-tree cursor structure. This is used mainly for SQL
465
selects, updates, and deletes. */
466
467
struct
btr_pcur_t
{
468
btr_cur_t
btr_cur
;
469
ulint
latch_mode
;
480
ulint
old_stored
;
482
rec_t*
old_rec
;
486
ulint
old_n_fields
;
487
ulint
rel_pos
;
491
buf_block_t
* block_when_stored;
/* buffer block when the position was
492
stored */
493
ib_uint64_t
modify_clock
;
496
ulint
pos_state
;
500
ulint
search_mode
;
501
trx_t
*
trx_if_known
;
505
/*-----------------------------*/
506
/* NOTE that the following fields may possess dynamically allocated
507
memory which should be freed if not needed anymore! */
508
509
byte*
old_rec_buf
;
511
ulint
buf_size
;
513
};
514
515
#define BTR_PCUR_IS_POSITIONED 1997660512
/* TODO: currently, the state
516
can be BTR_PCUR_IS_POSITIONED,
517
though it really should be
518
BTR_PCUR_WAS_POSITIONED,
519
because we have no obligation
520
to commit the cursor with
521
mtr; similarly latch_mode may
522
be out of date. This can
523
lead to problems if btr_pcur
524
is not used the right way;
525
all current code should be
526
ok. */
527
#define BTR_PCUR_WAS_POSITIONED 1187549791
528
#define BTR_PCUR_NOT_POSITIONED 1328997689
529
530
#define BTR_PCUR_OLD_STORED 908467085
531
#define BTR_PCUR_OLD_NOT_STORED 122766467
532
533
#ifndef UNIV_NONINL
534
#include "btr0pcur.ic"
535
#endif
536
537
#endif
storage
innobase
include
btr0pcur.h
Generated on Sat Nov 9 2013 01:26:34 for MySQL 5.6.14 Source Code Document by
1.8.1.2