diff options
author | monty@mysql.com <> | 2006-05-24 11:56:59 +0300 |
---|---|---|
committer | monty@mysql.com <> | 2006-05-24 11:56:59 +0300 |
commit | 97b941d924a70920a592f71d73c7712e75f9a411 (patch) | |
tree | 20d3e7d67881628df33708fc37eeebee886c5f5e /sql/field.cc | |
parent | 474ef8ed43c5f87da6a3c85e9cbc3e8fc18b47d0 (diff) | |
download | mariadb-git-97b941d924a70920a592f71d73c7712e75f9a411.tar.gz |
Remove dflt_field from field structure as this was only needed when createing temporary table and I found another soultion that doesn't increase the size of the field structure for all table instances. (Better fix for bug #19089)
Fixed compiler warnings
Fixed valgrind warning in Item_date_add_intervall::eq. (Recoding of bugfix #19490)
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sql/field.cc b/sql/field.cc index c31fbacc25e..a920d6d91b1 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1222,13 +1222,13 @@ Field::Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, struct st_table *table_arg) - :ptr(ptr_arg),null_ptr(null_ptr_arg), + :ptr(ptr_arg), null_ptr(null_ptr_arg), table(table_arg),orig_table(table_arg), table_name(table_arg ? &table_arg->alias : &unknown_table_name), field_name(field_name_arg), query_id(0), key_start(0), part_of_key(0), part_of_sortkey(0), unireg_check(unireg_check_arg), - field_length(length_arg), null_bit(null_bit_arg), dflt_field(0) + field_length(length_arg), null_bit(null_bit_arg) { flags=null_ptr ? 0: NOT_NULL_FLAG; comment.str= (char*) ""; @@ -8964,22 +8964,21 @@ create_field::create_field(Field *old_field,Field *orig_field) old_field->table->timestamp_field != old_field || /* timestamp field */ unireg_check == Field::TIMESTAMP_UN_FIELD)) /* has default val */ { - char buff[MAX_FIELD_WIDTH],*pos; - String tmp(buff,sizeof(buff), charset), *res; my_ptrdiff_t diff; /* Get the value from default_values */ diff= (my_ptrdiff_t) (orig_field->table->s->default_values- orig_field->table->record[0]); orig_field->move_field(diff); // Points now at default_values - bool is_null=orig_field->is_real_null(); - res= orig_field->val_str(&tmp); - orig_field->move_field(-diff); // Back to record[0] - if (!is_null) + if (!orig_field->is_real_null()) { + char buff[MAX_FIELD_WIDTH],*pos; + String tmp(buff,sizeof(buff), charset), *res; + res= orig_field->val_str(&tmp); pos= (char*) sql_strmake(res->ptr(), res->length()); def= new Item_string(pos, res->length(), charset); } + orig_field->move_field(-diff); // Back to record[0] } } |