diff options
author | unknown <holyfoot/hf@mysql.com/deer.(none)> | 2006-11-01 15:41:51 +0400 |
---|---|---|
committer | unknown <holyfoot/hf@mysql.com/deer.(none)> | 2006-11-01 15:41:51 +0400 |
commit | bec1973eee55af5b681ad737e6edfb7543faff6d (patch) | |
tree | d171ff0c22675cb8769a8caeea49028d3ccbef81 /sql/item.cc | |
parent | 81dac08b5205a7ef81c80ea824a487df95cb8f51 (diff) | |
parent | d922d5b6be1d45069bd87614a2688c49ef25ad8b (diff) | |
download | mariadb-git-bec1973eee55af5b681ad737e6edfb7543faff6d.tar.gz |
Merge mysql.com:/home/hf/work/19491/my50-19491
into mysql.com:/home/hf/work/mysql-5.0.19491
sql/field.cc:
Auto merged
sql/field.h:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_timefunc.cc:
Auto merged
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index d56ca95093b..16881dd4e9e 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -272,6 +272,34 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value) } +my_decimal *Item::val_decimal_from_date(my_decimal *decimal_value) +{ + DBUG_ASSERT(fixed == 1); + TIME ltime; + longlong date; + if (get_date(<ime, TIME_FUZZY_DATE)) + { + my_decimal_set_zero(decimal_value); + return 0; + } + return date2my_decimal(<ime, decimal_value); +} + + +my_decimal *Item::val_decimal_from_time(my_decimal *decimal_value) +{ + DBUG_ASSERT(fixed == 1); + TIME ltime; + longlong date; + if (get_time(<ime)) + { + my_decimal_set_zero(decimal_value); + return 0; + } + return date2my_decimal(<ime, decimal_value); +} + + double Item::val_real_from_decimal() { /* Note that fix_fields may not be called for Item_avg_field items */ @@ -295,6 +323,25 @@ longlong Item::val_int_from_decimal() return result; } +int Item::save_time_in_field(Field *field) +{ + TIME ltime; + if (get_time(<ime)) + return set_field_to_null(field); + field->set_notnull(); + return field->store_time(<ime, MYSQL_TIMESTAMP_TIME); +} + + +int Item::save_date_in_field(Field *field) +{ + TIME ltime; + if (get_date(<ime, TIME_FUZZY_DATE)) + return set_field_to_null(field); + field->set_notnull(); + return field->store_time(<ime, MYSQL_TIMESTAMP_DATETIME); +} + Item::Item(): rsize(0), name(0), orig_name(0), name_length(0), fixed(0), |