Skip to content

Commit 13baa75

Browse files
author
Jorgen Loland
committed
Merge BUG#12997905 from 5.1 to 5.5
--BZR-- revision-id: [email protected] property-branch-nick: mysql-5.5 testament3-sha1: ec702ed09edd3eefd0c79c5634121f9ebe6f1cbb
2 parents b276be8 + 095981d commit 13baa75

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

sql/field.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,6 +2227,23 @@ class Copy_field :public Sql_alloc {
22272227
uchar *from_null_ptr,*to_null_ptr;
22282228
my_bool *null_row;
22292229
uint from_bit,to_bit;
2230+
/**
2231+
Number of bytes in the fields pointed to by 'from_ptr' and
2232+
'to_ptr'. Usually this is the number of bytes that are copied from
2233+
'from_ptr' to 'to_ptr'.
2234+
2235+
For variable-length fields (VARCHAR), the first byte(s) describe
2236+
the actual length of the text. For VARCHARs with length
2237+
< 256 there is 1 length byte
2238+
>= 256 there is 2 length bytes
2239+
Thus, if from_field is VARCHAR(10), from_length (and in most cases
2240+
to_length) is 11. For VARCHAR(1024), the length is 1026. @see
2241+
Field_varstring::length_bytes
2242+
2243+
Note that for VARCHARs, do_copy() will be do_varstring*() which
2244+
only copies the length-bytes (1 or 2) + the actual length of the
2245+
text instead of from/to_length bytes. @see get_copy_func()
2246+
*/
22302247
uint from_length,to_length;
22312248
Field *from_field,*to_field;
22322249
String tmp; // For items

sql/field_conv.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ Copy_field::get_copy_func(Field *to,Field *from)
709709
if (((Field_varstring*) to)->length_bytes !=
710710
((Field_varstring*) from)->length_bytes)
711711
return do_field_string;
712-
if (to_length != from_length)
712+
else
713713
return (((Field_varstring*) to)->length_bytes == 1 ?
714714
(from->charset()->mbmaxlen == 1 ? do_varstring1 :
715715
do_varstring1_mb) :

sql/sql_select.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10894,6 +10894,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
1089410894
if (open_tmp_table(table))
1089510895
goto err;
1089610896

10897+
// Make empty record so random data is not written to disk
10898+
empty_record(table);
10899+
1089710900
thd->mem_root= mem_root_save;
1089810901

1089910902
DBUG_RETURN(table);

0 commit comments

Comments
 (0)