diff options
author | holyfoot/hf@mysql.com/deer.(none) <> | 2006-11-06 11:10:08 +0400 |
---|---|---|
committer | holyfoot/hf@mysql.com/deer.(none) <> | 2006-11-06 11:10:08 +0400 |
commit | 50d199848b13ccb0b1d3d5faa0e6e23bd9ccd435 (patch) | |
tree | 2116e7b1ac8f88ec7e01e57470d2c65c1a8385a4 /sql/item.cc | |
parent | 79abdb38f89913041c52cbacfb225cec5ec4cc4a (diff) | |
parent | 5f42ec19b760931864e6e7b28a1cff9aff06d1ad (diff) | |
download | mariadb-git-50d199848b13ccb0b1d3d5faa0e6e23bd9ccd435.tar.gz |
Merge bk@192.168.21.1:mysql-5.0-opt
into mysql.com:/home/hf/work/19491/my50-19491
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 d0777f8f2a2..b26f65ead69 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), |