summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.h
diff options
context:
space:
mode:
authorEvgeny Potemkin <epotemkin@mysql.com>2010-10-07 11:07:56 +0400
committerEvgeny Potemkin <epotemkin@mysql.com>2010-10-07 11:07:56 +0400
commit3c9c7efb3b9f505e3db5b2dc2fdef30893f7d5f0 (patch)
treefaa94ed990e76cab367149941d91bce0b95a772d /sql/item_timefunc.h
parent32de99125a2fa6aace8650e8a4a1a5087fcf614a (diff)
downloadmariadb-git-3c9c7efb3b9f505e3db5b2dc2fdef30893f7d5f0.tar.gz
Bug#57039: constant subtime expression returns incorrect result.
The subtime function wasn't able to produce correct int representation of its result. For constant expressions the Item_datetime_cache is used to speedup evaluation and Item_datetime_cache expects underlying item to return correct int representation of DATETIME value. These two factors combined led to a wrong query result. Now the Item_func_add_time has function val_datetime which performs the calculation and saves result into given MYSQL_TIME struct, it also sets null_value to appropriate value. val_int and val_str member functions convert the result obtained from val_datetime to int or string respectively and returns it. mysql-test/r/func_time.result: Added a test case for the bug#57039. mysql-test/t/func_time.test: Added a test case for the bug#57039. sql/item_timefunc.cc: Bug#57039: constant subtime expression returns incorrect result. Now the Item_func_add_time has function val_datetime which performs the calculation and saves result into given MYSQL_TIME struct, it also sets null_value to appropriate value. val_int and val_str member functions convert the result obtained from val_datetime to int or string respectively and returns it. sql/item_timefunc.h: Bug#57039: constant subtime expression returns incorrect result.
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r--sql/item_timefunc.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 6e31b5c6705..d82a8f9e969 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -949,6 +949,8 @@ public:
return save_date_in_field(field);
return Item_str_func::save_in_field(field, no_conversions);
}
+ longlong val_int();
+ MYSQL_TIME *val_datetime(MYSQL_TIME *time, date_time_format_types *format);
};
class Item_func_timediff :public Item_str_timefunc