Skip to content

Commit 4dbd101

Browse files
Merge [email protected]:/home/bk/mysql-5.0
into hundin.mysql.fi:/home/marko/j/mysql-5.0
2 parents b1387f5 + 3653b08 commit 4dbd101

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

innobase/include/rem0rec.ic

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,6 @@ rec_get_nth_field(
880880
length = rec_offs_base(offsets)[1 + n];
881881

882882
if (length & REC_OFFS_SQL_NULL) {
883-
field = NULL;
884883
length = UNIV_SQL_NULL;
885884
} else {
886885
length &= REC_OFFS_MASK;
@@ -1185,6 +1184,7 @@ rec_set_nth_field(
11851184
byte* data2;
11861185
ulint len2;
11871186

1187+
ut_ad(rec);
11881188
ut_ad(rec_offs_validate(rec, NULL, offsets));
11891189

11901190
if (len == UNIV_SQL_NULL) {
@@ -1195,14 +1195,15 @@ rec_set_nth_field(
11951195
}
11961196

11971197
data2 = rec_get_nth_field(rec, offsets, n, &len2);
1198-
ut_ad(len2 == len);
1199-
1200-
ut_memcpy(data2, data, len);
1201-
12021198
if (len2 == UNIV_SQL_NULL) {
12031199
ut_ad(!rec_offs_comp(offsets));
12041200
rec_set_nth_field_null_bit(rec, n, FALSE);
1201+
ut_ad(len == rec_get_nth_field_size(rec, n));
1202+
} else {
1203+
ut_ad(len2 == len);
12051204
}
1205+
1206+
ut_memcpy(data2, data, len);
12061207
}
12071208

12081209
/**************************************************************

innobase/rem/rem0rec.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,25 +137,27 @@ rec_validate_old(
137137
rec_t* rec); /* in: physical record */
138138

139139
/**********************************************************
140-
The following function determines the offsets to each field
141-
in the record. The offsets are written to an array of
142-
ulint[n+2], with [0] being the number of fields (n), [1] being the
143-
extra size (if REC_OFFS_COMPACT is set, the record is in the new
144-
format), and [2]..[n+1] being the offsets past the end of
145-
fields 0..n, or to the beginning of fields 1..n+1. When the
146-
high-order bit of the offset at [n+1] is set (REC_OFFS_SQL_NULL),
147-
the field n is NULL. When the second high-order bit of the offset
148-
at [n+1] is set (REC_OFFS_EXTERNAL), the field n is being stored
149-
externally. */
140+
The following function determines the offsets to each field in the
141+
record. The offsets are written to a previously allocated array of
142+
ulint, where rec_offs_n_fields(offsets) has been initialized to the
143+
number of fields in the record. The rest of the array will be
144+
initialized by this function. rec_offs_base(offsets)[0] will be set
145+
to the extra size (if REC_OFFS_COMPACT is set, the record is in the
146+
new format), and rec_offs_base(offsets)[1..n_fields] will be set to
147+
offsets past the end of fields 0..n_fields, or to the beginning of
148+
fields 1..n_fields+1. When the high-order bit of the offset at [i+1]
149+
is set (REC_OFFS_SQL_NULL), the field i is NULL. When the second
150+
high-order bit of the offset at [i+1] is set (REC_OFFS_EXTERNAL), the
151+
field i is being stored externally. */
150152
static
151153
void
152154
rec_init_offsets(
153155
/*=============*/
154156
/* out: the offsets */
155157
rec_t* rec, /* in: physical record */
156158
dict_index_t* index, /* in: record descriptor */
157-
ulint* offsets)/* in:/out: ulint[n+2];
158-
n=rec_offs_n_fields(offsets) */
159+
ulint* offsets)/* in/out: array of offsets;
160+
in: n=rec_offs_n_fields(offsets) */
159161
{
160162
ulint n_fields = rec_offs_n_fields(offsets);
161163
ulint i = 0;

0 commit comments

Comments
 (0)