2599
2599
ut_ad(prebuilt->mysql_template);
2600
ut_ad(prebuilt->default_rec);
2600
2601
ut_ad(rec_offs_validate(rec, NULL, offsets));
2602
2603
if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) {
2683
2684
&= ~(byte) templ->mysql_null_bit_mask;
2686
/* MySQL seems to assume the field for an SQL NULL
2687
value is set to zero or space. Not taking this into
2688
account caused seg faults with NULL BLOB fields, and
2689
bug number 154 in the MySQL bug database: GROUP BY
2690
and DISTINCT could treat NULL values inequal. */
2687
/* MySQL assumes that the field for an SQL
2688
NULL value is set to the default value. */
2693
2690
mysql_rec[templ->mysql_null_byte_offset]
2694
2691
|= (byte) templ->mysql_null_bit_mask;
2695
switch (templ->type) {
2699
if (templ->mysql_type
2700
== DATA_MYSQL_TRUE_VARCHAR) {
2701
/* This is a >= 5.0.3 type
2702
true VARCHAR. Zero the field. */
2708
case DATA_FIXBINARY:
2710
/* MySQL pads all string types (except
2711
BLOB, TEXT and true VARCHAR) with space. */
2712
if (UNIV_UNLIKELY(templ->mbminlen == 2)) {
2713
/* Treat UCS2 as a special case. */
2715
+ templ->mysql_col_offset;
2716
len = templ->mysql_col_len;
2717
/* There are two UCS2 bytes per char,
2718
so the length has to be even. */
2720
/* Pad with 0x0020. */
2735
ut_ad(!pad_char || templ->mbminlen == 1);
2736
memset(mysql_rec + templ->mysql_col_offset,
2737
pad_char, templ->mysql_col_len);
2692
memcpy(mysql_rec + templ->mysql_col_offset,
2693
prebuilt->default_rec + templ->mysql_col_offset,
2694
templ->mysql_col_len);