From c247bf9dc3c370c70dc763dcf361c85ee20035fd Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Oct 2006 10:17:39 +0200 Subject: BUG#21811 Odd casting with date + INTERVAL arithmetic - Type casting was not consequent, thus when adding a DATE type with a WEEK interval the result tpe was DATETIME and not DATE as is the norm. - By changing the order of the date type enumerations the type casting bug is resolved. To comply with the new order the array interval_type_to_name needed to change accordingly. include/my_time.h: Changed enumeration order to make week interval appear in a more logical order. This affects type casting when a date is added to an interval. sql/time.cc: Moved string WEEK to match enumeration in interval_type --- sql/time.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sql/time.cc') diff --git a/sql/time.cc b/sql/time.cc index 0461f7723c6..467dbc684a5 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -25,14 +25,25 @@ #ifndef TESTTIME +/* + Name description of interval names used in statements. + + 'interval_type_to_name' is ordered and sorted on interval size and + interval complexity. + Order of elements in 'interval_type_to_name' should correspond to + the order of elements in 'interval_type' enum + + See also interval_type, interval_names +*/ + LEX_STRING interval_type_to_name[INTERVAL_LAST] = { { C_STRING_WITH_LEN("YEAR")}, { C_STRING_WITH_LEN("QUARTER")}, { C_STRING_WITH_LEN("MONTH")}, + { C_STRING_WITH_LEN("WEEK")}, { C_STRING_WITH_LEN("DAY")}, { C_STRING_WITH_LEN("HOUR")}, { C_STRING_WITH_LEN("MINUTE")}, - { C_STRING_WITH_LEN("WEEK")}, { C_STRING_WITH_LEN("SECOND")}, { C_STRING_WITH_LEN("MICROSECOND")}, { C_STRING_WITH_LEN("YEAR_MONTH")}, -- cgit v1.2.1