~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/btr0pcur.ic

  • Committer: Brian Aker
  • Date: 2008-10-28 08:36:02 UTC
  • mfrom: (520.4.13 merge-innodb-plugin)
  • Revision ID: brian@tangent.org-20081028083602-0p3zzlhlxr5q2sqo
Merging Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
ulint
14
14
btr_pcur_get_rel_pos(
15
15
/*=================*/
16
 
                                /* out: BTR_PCUR_ON, ... */
17
 
        btr_pcur_t*     cursor) /* in: persistent cursor */
 
16
                                        /* out: BTR_PCUR_ON, ... */
 
17
        const btr_pcur_t*       cursor) /* in: persistent cursor */
18
18
{
19
19
        ut_ad(cursor);
20
20
        ut_ad(cursor->old_rec);
53
53
        return(cursor->mtr);
54
54
}
55
55
 
 
56
#ifdef UNIV_DEBUG
56
57
/*************************************************************
57
58
Returns the btr cursor component of a persistent cursor. */
58
59
UNIV_INLINE
59
60
btr_cur_t*
60
61
btr_pcur_get_btr_cur(
61
62
/*=================*/
62
 
                                /* out: pointer to btr cursor component */
63
 
        btr_pcur_t*     cursor) /* in: persistent cursor */
 
63
                                        /* out: pointer to
 
64
                                        btr cursor component */
 
65
        const btr_pcur_t*       cursor) /* in: persistent cursor */
64
66
{
65
 
        return(&(cursor->btr_cur));
 
67
        const btr_cur_t*        btr_cur = &cursor->btr_cur;
 
68
        return((btr_cur_t*) btr_cur);
66
69
}
67
70
 
68
71
/*************************************************************
71
74
page_cur_t*
72
75
btr_pcur_get_page_cur(
73
76
/*==================*/
74
 
                                /* out: pointer to page cursor component */
75
 
        btr_pcur_t*     cursor) /* in: persistent cursor */
 
77
                                        /* out: pointer to page cursor
 
78
                                        component */
 
79
        const btr_pcur_t*       cursor) /* in: persistent cursor */
76
80
{
77
 
        return(btr_cur_get_page_cur(&(cursor->btr_cur)));
 
81
        return(btr_cur_get_page_cur(btr_pcur_get_btr_cur(cursor)));
78
82
}
79
 
 
 
83
#endif /* UNIV_DEBUG */
80
84
/*************************************************************
81
85
Returns the page of a persistent cursor. */
82
86
UNIV_INLINE
88
92
{
89
93
        ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
90
94
 
91
 
        return(page_cur_get_page(btr_pcur_get_page_cur(cursor)));
 
95
        return(btr_cur_get_page(btr_pcur_get_btr_cur(cursor)));
 
96
}
 
97
 
 
98
/*************************************************************
 
99
Returns the buffer block of a persistent cursor. */
 
100
UNIV_INLINE
 
101
buf_block_t*
 
102
btr_pcur_get_block(
 
103
/*===============*/
 
104
                                /* out: pointer to the block */
 
105
        btr_pcur_t*     cursor) /* in: persistent cursor */
 
106
{
 
107
        ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
 
108
 
 
109
        return(btr_cur_get_block(btr_pcur_get_btr_cur(cursor)));
92
110
}
93
111
 
94
112
/*************************************************************
103
121
        ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
104
122
        ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
105
123
 
106
 
        return(page_cur_get_rec(btr_pcur_get_page_cur(cursor)));
 
124
        return(btr_cur_get_rec(btr_pcur_get_btr_cur(cursor)));
107
125
}
108
126
 
109
127
/******************************************************************
158
176
ibool
159
177
btr_pcur_is_after_last_on_page(
160
178
/*===========================*/
161
 
        btr_pcur_t*     cursor, /* in: persistent cursor */
162
 
        mtr_t*          mtr)    /* in: mtr */
 
179
        const btr_pcur_t*       cursor) /* in: persistent cursor */
163
180
{
164
 
        UT_NOT_USED(mtr);
165
181
        ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
166
182
        ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
167
183
 
175
191
ibool
176
192
btr_pcur_is_before_first_on_page(
177
193
/*=============================*/
178
 
        btr_pcur_t*     cursor, /* in: persistent cursor */
179
 
        mtr_t*          mtr)    /* in: mtr */
 
194
        const btr_pcur_t*       cursor) /* in: persistent cursor */
180
195
{
181
 
        UT_NOT_USED(mtr);
182
196
        ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
183
197
        ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
184
198
 
191
205
ibool
192
206
btr_pcur_is_on_user_rec(
193
207
/*====================*/
194
 
        btr_pcur_t*     cursor, /* in: persistent cursor */
195
 
        mtr_t*          mtr)    /* in: mtr */
 
208
        const btr_pcur_t*       cursor) /* in: persistent cursor */
196
209
{
197
210
        ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
198
211
        ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
199
212
 
200
 
        if ((btr_pcur_is_before_first_on_page(cursor, mtr))
201
 
            || (btr_pcur_is_after_last_on_page(cursor, mtr))) {
 
213
        if (btr_pcur_is_before_first_on_page(cursor)
 
214
            || btr_pcur_is_after_last_on_page(cursor)) {
202
215
 
203
216
                return(FALSE);
204
217
        }
254
267
void
255
268
btr_pcur_move_to_next_on_page(
256
269
/*==========================*/
257
 
        btr_pcur_t*     cursor, /* in: persistent cursor */
258
 
        mtr_t*          mtr)    /* in: mtr */
 
270
        btr_pcur_t*     cursor) /* in/out: persistent cursor */
259
271
{
260
 
        UT_NOT_USED(mtr);
261
272
        ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
262
273
        ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
263
274
 
272
283
void
273
284
btr_pcur_move_to_prev_on_page(
274
285
/*==========================*/
275
 
        btr_pcur_t*     cursor, /* in: persistent cursor */
276
 
        mtr_t*          mtr)    /* in: mtr */
 
286
        btr_pcur_t*     cursor) /* in/out: persistent cursor */
277
287
{
278
 
        UT_NOT_USED(mtr);
279
288
        ut_ad(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
280
289
        ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
281
290
 
296
305
        UT_NOT_USED(mtr);
297
306
        ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
298
307
 
299
 
        page_cur_set_after_last(buf_frame_align(btr_pcur_get_rec(cursor)),
 
308
        page_cur_set_after_last(btr_pcur_get_block(cursor),
300
309
                                btr_pcur_get_page_cur(cursor));
301
310
 
302
311
        cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
319
328
        ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
320
329
        cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
321
330
loop:
322
 
        if (btr_pcur_is_after_last_on_page(cursor, mtr)) {
 
331
        if (btr_pcur_is_after_last_on_page(cursor)) {
323
332
 
324
333
                if (btr_pcur_is_after_last_in_tree(cursor, mtr)) {
325
334
 
328
337
 
329
338
                btr_pcur_move_to_next_page(cursor, mtr);
330
339
        } else {
331
 
                btr_pcur_move_to_next_on_page(cursor, mtr);
 
340
                btr_pcur_move_to_next_on_page(cursor);
332
341
        }
333
342
 
334
 
        if (btr_pcur_is_on_user_rec(cursor, mtr)) {
 
343
        if (btr_pcur_is_on_user_rec(cursor)) {
335
344
 
336
345
                return(TRUE);
337
346
        }
357
366
 
358
367
        cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
359
368
 
360
 
        if (btr_pcur_is_after_last_on_page(cursor, mtr)) {
 
369
        if (btr_pcur_is_after_last_on_page(cursor)) {
361
370
 
362
371
                if (btr_pcur_is_after_last_in_tree(cursor, mtr)) {
363
372
 
369
378
                return(TRUE);
370
379
        }
371
380
 
372
 
        btr_pcur_move_to_next_on_page(cursor, mtr);
 
381
        btr_pcur_move_to_next_on_page(cursor);
373
382
 
374
383
        return(TRUE);
375
384
}
466
475
btr_pcur_open(
467
476
/*==========*/
468
477
        dict_index_t*   index,  /* in: index */
469
 
        dtuple_t*       tuple,  /* in: tuple on which search done */
 
478
        const dtuple_t* tuple,  /* in: tuple on which search done */
470
479
        ulint           mode,   /* in: PAGE_CUR_L, ...;
471
480
                                NOTE that if the search is made using a unique
472
481
                                prefix of a record, mode should be
505
514
btr_pcur_open_with_no_init(
506
515
/*=======================*/
507
516
        dict_index_t*   index,  /* in: index */
508
 
        dtuple_t*       tuple,  /* in: tuple on which search done */
 
517
        const dtuple_t* tuple,  /* in: tuple on which search done */
509
518
        ulint           mode,   /* in: PAGE_CUR_L, ...;
510
519
                                NOTE that if the search is made using a unique
511
520
                                prefix of a record, mode should be
620
629
        }
621
630
 
622
631
        cursor->btr_cur.page_cur.rec = NULL;
 
632
        cursor->btr_cur.page_cur.block = NULL;
623
633
        cursor->old_rec = NULL;
624
634
        cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
625
635