summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-05-19 19:16:17 +0200
committerSergei Golubchik <sergii@pisem.net>2011-05-19 19:16:17 +0200
commitf06cac336ba7a27493fc753d2bf37e87137a1cdc (patch)
treea54fa81ccb21526e54c820e1a69c4362f248b302 /sql-common
parent03b33425e5a3de3fad070aa21e7fc7baf8104c81 (diff)
downloadmariadb-git-f06cac336ba7a27493fc753d2bf37e87137a1cdc.tar.gz
post review changes 2
sql/event_parse_data.cc: don't use "not_used" variable sql/item_timefunc.cc: Item_temporal_func::fix_length_and_dec() and other changes sql/item_timefunc.h: introducing Item_timefunc::fix_length_and_dec() sql/share/errmsg.txt: don't say "column X" in the error message that used not only for columns
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/my_time.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 788edc88ff0..264fc5b957b 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -19,9 +19,6 @@
/* Windows version of localtime_r() is declared in my_ptrhead.h */
#include <my_pthread.h>
-static enum enum_mysql_timestamp_type str_to_time(const char *, uint,
- MYSQL_TIME *, int *);
-
ulonglong log_10_int[20]=
{
1, 10, 100, 1000, 10000UL, 100000UL, 1000000UL, 10000000UL,
@@ -491,7 +488,7 @@ err:
MYSQL_TIMESTAMP_ERROR
*/
-static enum enum_mysql_timestamp_type
+enum enum_mysql_timestamp_type
str_to_time(const char *str, uint length, MYSQL_TIME *l_time, int *warning)
{
ulong date[5];
@@ -716,7 +713,7 @@ int check_time_range(struct st_mysql_time *my_time, uint dec, int *warning)
my_time->hour= TIME_MAX_HOUR;
my_time->minute= TIME_MAX_MINUTE;
my_time->second= TIME_MAX_SECOND;
- my_time->second_part= TIME_MAX_SECOND_PART;
+ my_time->second_part= max_sec_part[dec];
*warning|= MYSQL_TIME_WARN_OUT_OF_RANGE;
return 0;
}
@@ -1245,7 +1242,7 @@ int number_to_time(double nr, MYSQL_TIME *ltime, int *was_cut)
ltime->hour = tmp/100/100;
ltime->minute= tmp/100%100;
ltime->second= tmp%100;
- ltime->second_part= (ulong)((nr-tmp)*1e6);
+ ltime->second_part= (ulong)((nr-tmp)*TIME_SECOND_PART_FACTOR);
if (ltime->minute < 60 && ltime->second < 60)
return 0;
@@ -1336,7 +1333,7 @@ double TIME_to_double(const MYSQL_TIME *my_time)
if (my_time->time_type == MYSQL_TIMESTAMP_DATE)
return d;
- d+= my_time->second_part/1e6;
+ d+= my_time->second_part/(double)TIME_SECOND_PART_FACTOR;
return my_time->neg ? -d : d;
}