~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/row0row.ic

Reverted 1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 1996, 2009, Innobase Oy. 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., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file include/row0row.ic
21
 
General row routines
22
 
 
23
 
Created 4/20/1996 Heikki Tuuri
24
 
*******************************************************/
25
 
 
26
 
#include "dict0dict.h"
27
 
#include "rem0rec.h"
28
 
#include "trx0undo.h"
29
 
 
30
 
/*********************************************************************//**
31
 
Reads the trx id field from a clustered index record.
32
 
@return value of the field */
33
 
UNIV_INLINE
34
 
trx_id_t
35
 
row_get_rec_trx_id(
36
 
/*===============*/
37
 
        const rec_t*    rec,    /*!< in: record */
38
 
        dict_index_t*   index,  /*!< in: clustered index */
39
 
        const ulint*    offsets)/*!< in: rec_get_offsets(rec, index) */
40
 
{
41
 
        ulint   offset;
42
 
 
43
 
        ut_ad(dict_index_is_clust(index));
44
 
        ut_ad(rec_offs_validate(rec, index, offsets));
45
 
 
46
 
        offset = index->trx_id_offset;
47
 
 
48
 
        if (!offset) {
49
 
                offset = row_get_trx_id_offset(rec, index, offsets);
50
 
        }
51
 
 
52
 
        return(trx_read_trx_id(rec + offset));
53
 
}
54
 
 
55
 
/*********************************************************************//**
56
 
Reads the roll pointer field from a clustered index record.
57
 
@return value of the field */
58
 
UNIV_INLINE
59
 
roll_ptr_t
60
 
row_get_rec_roll_ptr(
61
 
/*=================*/
62
 
        const rec_t*    rec,    /*!< in: record */
63
 
        dict_index_t*   index,  /*!< in: clustered index */
64
 
        const ulint*    offsets)/*!< in: rec_get_offsets(rec, index) */
65
 
{
66
 
        ulint   offset;
67
 
 
68
 
        ut_ad(dict_index_is_clust(index));
69
 
        ut_ad(rec_offs_validate(rec, index, offsets));
70
 
 
71
 
        offset = index->trx_id_offset;
72
 
 
73
 
        if (!offset) {
74
 
                offset = row_get_trx_id_offset(rec, index, offsets);
75
 
        }
76
 
 
77
 
        return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));
78
 
}
79
 
 
80
 
/*******************************************************************//**
81
 
Builds from a secondary index record a row reference with which we can
82
 
search the clustered index record. */
83
 
UNIV_INLINE
84
 
void
85
 
row_build_row_ref_fast(
86
 
/*===================*/
87
 
        dtuple_t*       ref,    /*!< in/out: typed data tuple where the
88
 
                                reference is built */
89
 
        const ulint*    map,    /*!< in: array of field numbers in rec
90
 
                                telling how ref should be built from
91
 
                                the fields of rec */
92
 
        const rec_t*    rec,    /*!< in: record in the index; must be
93
 
                                preserved while ref is used, as we do
94
 
                                not copy field values to heap */
95
 
        const ulint*    offsets)/*!< in: array returned by rec_get_offsets() */
96
 
{
97
 
        dfield_t*       dfield;
98
 
        const byte*     field;
99
 
        ulint           len;
100
 
        ulint           ref_len;
101
 
        ulint           field_no;
102
 
        ulint           i;
103
 
 
104
 
        ut_ad(rec_offs_validate(rec, NULL, offsets));
105
 
        ut_ad(!rec_offs_any_extern(offsets));
106
 
        ref_len = dtuple_get_n_fields(ref);
107
 
 
108
 
        for (i = 0; i < ref_len; i++) {
109
 
                dfield = dtuple_get_nth_field(ref, i);
110
 
 
111
 
                field_no = *(map + i);
112
 
 
113
 
                if (field_no != ULINT_UNDEFINED) {
114
 
 
115
 
                        field = rec_get_nth_field(rec, offsets,
116
 
                                                  field_no, &len);
117
 
                        dfield_set_data(dfield, field, len);
118
 
                }
119
 
        }
120
 
}