From 8ddcd0cda8e6e90a58e9ea64f0f3773ea0037f0b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 19 May 2011 19:01:46 +0200 Subject: 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. --- sql-common/my_time.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sql-common/my_time.c') diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 9bae4dec120..788edc88ff0 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -695,7 +695,7 @@ fractional: int check_time_range(struct st_mysql_time *my_time, uint dec, int *warning) { longlong hour; - static ulong max_sec_part[MAX_SEC_PART_DIGITS+1]= {000000, 900000, 990000, + static ulong max_sec_part[TIME_SECOND_PART_DIGITS+1]= {000000, 900000, 990000, 999000, 999900, 999990, 999999}; if (my_time->minute >= 60 || my_time->second >= 60) @@ -704,7 +704,7 @@ int check_time_range(struct st_mysql_time *my_time, uint dec, int *warning) hour= my_time->hour + (24*my_time->day); if (dec == AUTO_SEC_PART_DIGITS) - dec= MAX_SEC_PART_DIGITS; + dec= TIME_SECOND_PART_DIGITS; if (hour <= TIME_MAX_HOUR && (hour != TIME_MAX_HOUR || my_time->minute != TIME_MAX_MINUTE || @@ -1042,9 +1042,9 @@ int my_time_to_str(const MYSQL_TIME *l_time, char *to, int digits) ulong day= (l_time->year || l_time->month) ? 0 : l_time->day; if (digits == AUTO_SEC_PART_DIGITS) - digits= l_time->second_part ? MAX_SEC_PART_DIGITS : 0; + digits= l_time->second_part ? TIME_SECOND_PART_DIGITS : 0; - DBUG_ASSERT(digits >= 0 && digits <= MAX_SEC_PART_DIGITS); + DBUG_ASSERT(digits >= 0 && digits <= TIME_SECOND_PART_DIGITS); return sprintf(to, digits ? "%s%02lu:%02u:%02u.%0*lu" @@ -1063,9 +1063,9 @@ int my_date_to_str(const MYSQL_TIME *l_time, char *to) int my_datetime_to_str(const MYSQL_TIME *l_time, char *to, int digits) { if (digits == AUTO_SEC_PART_DIGITS) - digits= l_time->second_part ? MAX_SEC_PART_DIGITS : 0; + digits= l_time->second_part ? TIME_SECOND_PART_DIGITS : 0; - DBUG_ASSERT(digits >= 0 && digits <= MAX_SEC_PART_DIGITS); + DBUG_ASSERT(digits >= 0 && digits <= TIME_SECOND_PART_DIGITS); return sprintf(to, digits ? "%04u-%02u-%02u %02u:%02u:%02u.%0*lu" -- cgit v1.2.1