Commit f240aa4c authored by Sergey Petrunya's avatar Sergey Petrunya

field_conv.cc: added comments

opt_range.cc: modified print_key() so that it doesn't do memory re-allocs when
printing multipart keys over varchar columns. When it did, key printout in 
debug trace was interrupted with my_malloc/free printouts.
parent 63216194
...@@ -204,6 +204,14 @@ static void do_skip(Copy_field *copy __attribute__((unused))) ...@@ -204,6 +204,14 @@ static void do_skip(Copy_field *copy __attribute__((unused)))
} }
/*
Copy: (NULLable field) -> (NULLable field)
note: if the record we're copying from is NULL-complemetned (i.e.
from_field->table->null_row==1), it will also have all NULLable columns to be
set to NULLs, so we dont need to check table->null_row here.
*/
static void do_copy_null(Copy_field *copy) static void do_copy_null(Copy_field *copy)
{ {
if (*copy->from_null_ptr & copy->from_bit) if (*copy->from_null_ptr & copy->from_bit)
...@@ -218,6 +226,10 @@ static void do_copy_null(Copy_field *copy) ...@@ -218,6 +226,10 @@ static void do_copy_null(Copy_field *copy)
} }
} }
/*
Copy: (not-NULL field in table that can be NULL-complemented) -> (NULLable
field)
*/
static void do_outer_field_null(Copy_field *copy) static void do_outer_field_null(Copy_field *copy)
{ {
...@@ -235,6 +247,7 @@ static void do_outer_field_null(Copy_field *copy) ...@@ -235,6 +247,7 @@ static void do_outer_field_null(Copy_field *copy)
} }
/* Copy: (NULL-able field) -> (not NULL-able field) */
static void do_copy_not_null(Copy_field *copy) static void do_copy_not_null(Copy_field *copy)
{ {
if (*copy->from_null_ptr & copy->from_bit) if (*copy->from_null_ptr & copy->from_bit)
...@@ -248,6 +261,7 @@ static void do_copy_not_null(Copy_field *copy) ...@@ -248,6 +261,7 @@ static void do_copy_not_null(Copy_field *copy)
} }
/* Copy: (non-NULLable field) -> (NULLable field) */
static void do_copy_maybe_null(Copy_field *copy) static void do_copy_maybe_null(Copy_field *copy)
{ {
*copy->to_null_ptr&= ~copy->to_bit; *copy->to_null_ptr&= ~copy->to_bit;
......
...@@ -13644,7 +13644,6 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length) ...@@ -13644,7 +13644,6 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length)
{ {
char buff[1024]; char buff[1024];
const uchar *key_end= key+used_length; const uchar *key_end= key+used_length;
String tmp(buff,sizeof(buff),&my_charset_bin);
uint store_length; uint store_length;
TABLE *table= key_part->field->table; TABLE *table= key_part->field->table;
my_bitmap_map *old_sets[2]; my_bitmap_map *old_sets[2];
...@@ -13653,6 +13652,7 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length) ...@@ -13653,6 +13652,7 @@ print_key(KEY_PART *key_part, const uchar *key, uint used_length)
for (; key < key_end; key+=store_length, key_part++) for (; key < key_end; key+=store_length, key_part++)
{ {
String tmp(buff,sizeof(buff),&my_charset_bin);
Field *field= key_part->field; Field *field= key_part->field;
store_length= key_part->store_length; store_length= key_part->store_length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment