diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-03-17 14:13:03 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-03-17 14:13:03 +0100 |
commit | 1cda2654578b82da52c29a829d463955f8795cc9 (patch) | |
tree | f3a8de34f4bf0c331723a999dedc78e87be4b9bb /sql/field_conv.cc | |
parent | a169ede155937cba04b01ea104d7904d89f87007 (diff) | |
download | mariadb-git-1cda2654578b82da52c29a829d463955f8795cc9.tar.gz |
* fix for ALTER TABLE ... MODIFY timestamp->timestamp.
Use dedicated do_field_temporal() for Copy_field.
* check_time_range() needs to know TIME's precision to use the
correct max value.
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r-- | sql/field_conv.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc index a4fca6f8ad7..e4da3f114ef 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -365,6 +365,14 @@ static void do_field_decimal(Copy_field *copy) } +static void do_field_temporal(Copy_field *copy) +{ + MYSQL_TIME ltime; + copy->from_field->get_date(<ime, TIME_FUZZY_DATE); + copy->to_field->store_time(<ime, ltime.time_type); +} + + /** string copy for single byte characters set when to string is shorter than from string. @@ -559,7 +567,7 @@ void Copy_field::set(uchar *to,Field *from) /* To do: - If 'save\ is set to true and the 'from' is a blob field, do_copy is set to + If 'save' is set to true and the 'from' is a blob field, do_copy is set to do_save_blob rather than do_conv_blob. The only differences between them appears to be: @@ -657,6 +665,8 @@ Copy_field::get_copy_func(Field *to,Field *from) return do_field_int; if (to->result_type() == DECIMAL_RESULT) return do_field_decimal; + if (to->cmp_type() == TIME_RESULT) + return do_field_temporal; // Check if identical fields if (from->result_type() == STRING_RESULT) { |