diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-05-19 19:01:46 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-05-19 19:01:46 +0200 |
commit | 8ddcd0cda8e6e90a58e9ea64f0f3773ea0037f0b (patch) | |
tree | 4765748aeb7aafb09e259e1a355e28c11819e9c0 /sql/item_timefunc.h | |
parent | 5346cb8d2745acd660b301092458e231c9f53319 (diff) | |
download | mariadb-git-8ddcd0cda8e6e90a58e9ea64f0f3773ea0037f0b.tar.gz |
post-review changes 1
include/my_time.h:
remove duplicate defines.
cast to ulonglong to avoid overflow
sql/field.cc:
perform sign extension when reading packed TIME values
sql/item_cmpfunc.cc:
when converting a string to a date for the purpose of comparing it with another date,
we should ignore strict sql mode.
sql/item_timefunc.cc:
better error message
sql/item_timefunc.h:
limit decimals appropriately
sql/share/errmsg.txt:
don't refer to an object as a "column" in error messages that are used not only for columns.
Diffstat (limited to 'sql/item_timefunc.h')
-rw-r--r-- | sql/item_timefunc.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 68fd34aa29e..9f45655add6 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -332,7 +332,9 @@ public: void fix_length_and_dec() { maybe_null= TRUE; - decimals=args[0]->decimals; + decimals= args[0]->decimals; + if (decimals != NOT_FIXED_DEC) + set_if_smaller(decimals, TIME_SECOND_PART_DIGITS); max_length=17; } bool check_partition_func_processor(uchar *int_arg) {return FALSE;} @@ -389,7 +391,7 @@ public: void fix_length_and_dec() { max_length= MAX_TIME_WIDTH + - (decimals ? min(decimals, MAX_SEC_PART_DIGITS)+1 : 0); + (decimals ? min(decimals, TIME_SECOND_PART_DIGITS)+1 : 0); } }; @@ -597,8 +599,8 @@ public: collation.set(&my_charset_bin); maybe_null=1; decimals= args[0]->decimals; - if (decimals != NOT_FIXED_DEC && decimals > MAX_SEC_PART_DIGITS) - decimals= MAX_SEC_PART_DIGITS; + if (decimals != NOT_FIXED_DEC) + set_if_smaller(decimals, TIME_SECOND_PART_DIGITS); Item_timefunc::fix_length_and_dec(); } const char *func_name() const { return "sec_to_time"; } @@ -700,9 +702,13 @@ public: maybe_null= 1; max_length= MIN_TIME_WIDTH; if (decimals == NOT_FIXED_DEC) + { decimals= args[0]->decimals; + if (decimals != NOT_FIXED_DEC) + set_if_smaller(decimals, TIME_SECOND_PART_DIGITS); + } if (decimals && decimals != NOT_FIXED_DEC) - max_length+= min(decimals, MAX_SEC_PART_DIGITS) + 1; + max_length+= min(decimals, TIME_SECOND_PART_DIGITS) + 1; } }; @@ -722,7 +728,7 @@ public: maybe_null= 1; max_length= MAX_DATETIME_WIDTH; if (decimals && decimals != NOT_FIXED_DEC) - max_length+= min(decimals, MAX_SEC_PART_DIGITS) + 1; + max_length+= min(decimals, TIME_SECOND_PART_DIGITS) + 1; } }; |