~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2008-09-14 22:10:23 UTC
  • mto: This revision was merged to the branch mainline in revision 388.
  • Revision ID: monty@inaugust.com-20080914221023-otz8vuui590zp5yf
Got rid of libsqlcommon and some surious defines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#include "trx0undo.h"
12
12
 
13
13
/*************************************************************************
 
14
Reads the trx id or roll ptr field from a clustered index record: this function
 
15
is slower than the specialized inline functions. */
 
16
 
 
17
dulint
 
18
row_get_rec_sys_field(
 
19
/*==================*/
 
20
                                /* out: value of the field */
 
21
        ulint           type,   /* in: DATA_TRX_ID or DATA_ROLL_PTR */
 
22
        rec_t*          rec,    /* in: record */
 
23
        dict_index_t*   index,  /* in: clustered index */
 
24
        const ulint*    offsets);/* in: rec_get_offsets(rec, index) */
 
25
/*************************************************************************
 
26
Sets the trx id or roll ptr field in a clustered index record: this function
 
27
is slower than the specialized inline functions. */
 
28
 
 
29
void
 
30
row_set_rec_sys_field(
 
31
/*==================*/
 
32
                                /* out: value of the field */
 
33
        ulint           type,   /* in: DATA_TRX_ID or DATA_ROLL_PTR */
 
34
        rec_t*          rec,    /* in: record */
 
35
        dict_index_t*   index,  /* in: clustered index */
 
36
        const ulint*    offsets,/* in: rec_get_offsets(rec, index) */
 
37
        dulint          val);   /* in: value to set */
 
38
 
 
39
/*************************************************************************
14
40
Reads the trx id field from a clustered index record. */
15
41
UNIV_INLINE
16
42
dulint
17
43
row_get_rec_trx_id(
18
44
/*===============*/
19
45
                                /* out: value of the field */
20
 
        const rec_t*    rec,    /* in: record */
 
46
        rec_t*          rec,    /* in: record */
21
47
        dict_index_t*   index,  /* in: clustered index */
22
48
        const ulint*    offsets)/* in: rec_get_offsets(rec, index) */
23
49
{
24
50
        ulint   offset;
25
51
 
26
 
        ut_ad(dict_index_is_clust(index));
 
52
        ut_ad(index->type & DICT_CLUSTERED);
27
53
        ut_ad(rec_offs_validate(rec, index, offsets));
28
54
 
29
55
        offset = index->trx_id_offset;
30
56
 
31
 
        if (!offset) {
32
 
                offset = row_get_trx_id_offset(rec, index, offsets);
 
57
        if (offset) {
 
58
                return(trx_read_trx_id(rec + offset));
 
59
        } else {
 
60
                return(row_get_rec_sys_field(DATA_TRX_ID,
 
61
                                             rec, index, offsets));
33
62
        }
34
 
 
35
 
        return(trx_read_trx_id(rec + offset));
36
63
}
37
64
 
38
65
/*************************************************************************
42
69
row_get_rec_roll_ptr(
43
70
/*=================*/
44
71
                                /* out: value of the field */
45
 
        const rec_t*    rec,    /* in: record */
 
72
        rec_t*          rec,    /* in: record */
46
73
        dict_index_t*   index,  /* in: clustered index */
47
74
        const ulint*    offsets)/* in: rec_get_offsets(rec, index) */
48
75
{
49
76
        ulint   offset;
50
77
 
51
 
        ut_ad(dict_index_is_clust(index));
52
 
        ut_ad(rec_offs_validate(rec, index, offsets));
53
 
 
54
 
        offset = index->trx_id_offset;
55
 
 
56
 
        if (!offset) {
57
 
                offset = row_get_trx_id_offset(rec, index, offsets);
58
 
        }
59
 
 
60
 
        return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));
 
78
        ut_ad(index->type & DICT_CLUSTERED);
 
79
        ut_ad(rec_offs_validate(rec, index, offsets));
 
80
 
 
81
        offset = index->trx_id_offset;
 
82
 
 
83
        if (offset) {
 
84
                return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));
 
85
        } else {
 
86
                return(row_get_rec_sys_field(DATA_ROLL_PTR,
 
87
                                             rec, index, offsets));
 
88
        }
 
89
}
 
90
 
 
91
/*************************************************************************
 
92
Writes the trx id field to a clustered index record. */
 
93
UNIV_INLINE
 
94
void
 
95
row_set_rec_trx_id(
 
96
/*===============*/
 
97
        rec_t*          rec,    /* in: record */
 
98
        dict_index_t*   index,  /* in: clustered index */
 
99
        const ulint*    offsets,/* in: rec_get_offsets(rec, index) */
 
100
        dulint          trx_id) /* in: value of the field */
 
101
{
 
102
        ulint   offset;
 
103
 
 
104
        ut_ad(index->type & DICT_CLUSTERED);
 
105
        ut_ad(rec_offs_validate(rec, index, offsets));
 
106
 
 
107
        offset = index->trx_id_offset;
 
108
 
 
109
        if (offset) {
 
110
                trx_write_trx_id(rec + offset, trx_id);
 
111
        } else {
 
112
                row_set_rec_sys_field(DATA_TRX_ID,
 
113
                                      rec, index, offsets, trx_id);
 
114
        }
 
115
}
 
116
 
 
117
/*************************************************************************
 
118
Sets the roll pointer field in a clustered index record. */
 
119
UNIV_INLINE
 
120
void
 
121
row_set_rec_roll_ptr(
 
122
/*=================*/
 
123
        rec_t*          rec,    /* in: record */
 
124
        dict_index_t*   index,  /* in: clustered index */
 
125
        const ulint*    offsets,/* in: rec_get_offsets(rec, index) */
 
126
        dulint          roll_ptr)/* in: value of the field */
 
127
{
 
128
        ulint   offset;
 
129
 
 
130
        ut_ad(index->type & DICT_CLUSTERED);
 
131
        ut_ad(rec_offs_validate(rec, index, offsets));
 
132
 
 
133
        offset = index->trx_id_offset;
 
134
 
 
135
        if (offset) {
 
136
                trx_write_roll_ptr(rec + offset + DATA_TRX_ID_LEN, roll_ptr);
 
137
        } else {
 
138
                row_set_rec_sys_field(DATA_ROLL_PTR,
 
139
                                      rec, index, offsets, roll_ptr);
 
140
        }
61
141
}
62
142
 
63
143
/***********************************************************************
67
147
void
68
148
row_build_row_ref_fast(
69
149
/*===================*/
70
 
        dtuple_t*       ref,    /* in/out: typed data tuple where the
 
150
        dtuple_t*       ref,    /* in: typed data tuple where the
71
151
                                reference is built */
72
152
        const ulint*    map,    /* in: array of field numbers in rec
73
153
                                telling how ref should be built from
74
154
                                the fields of rec */
75
 
        const rec_t*    rec,    /* in: record in the index; must be
 
155
        rec_t*          rec,    /* in: record in the index; must be
76
156
                                preserved while ref is used, as we do
77
157
                                not copy field values to heap */
78
158
        const ulint*    offsets)/* in: array returned by rec_get_offsets() */
79
159
{
80
160
        dfield_t*       dfield;
81
 
        const byte*     field;
 
161
        byte*           field;
82
162
        ulint           len;
83
163
        ulint           ref_len;
84
164
        ulint           field_no;
85
165
        ulint           i;
86
166
 
87
167
        ut_ad(rec_offs_validate(rec, NULL, offsets));
88
 
        ut_ad(!rec_offs_any_extern(offsets));
89
168
        ref_len = dtuple_get_n_fields(ref);
90
169
 
91
170
        for (i = 0; i < ref_len; i++) {