diff options
author | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2011-02-02 20:13:28 +0200 |
---|---|---|
committer | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2011-02-02 20:13:28 +0200 |
commit | 3b65062d33c7e33ca67e9cc661f572b9c166572a (patch) | |
tree | 12d9c3f5bea6c6481050211f64ad22118d925c93 /sql | |
parent | 9b3884e9d75e5cab146a84875b53c93e454b19d5 (diff) | |
parent | ac3243c8c82077c34e99e8f7f9a83e5bc9fd7b66 (diff) | |
download | mariadb-git-3b65062d33c7e33ca67e9cc661f572b9c166572a.tar.gz |
merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysqld.cc | 13 | ||||
-rw-r--r-- | sql/sql_class.h | 2 | ||||
-rw-r--r-- | sql/sys_vars.cc | 12 |
3 files changed, 14 insertions, 13 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 188ed7c6885..cf1627ced57 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3080,12 +3080,6 @@ static int init_common_variables() max_system_variables.pseudo_thread_id= (ulong)~0; server_start_time= flush_status_time= my_time(0); - /* TODO: remove this when my_time_t is 64 bit compatible */ - if (server_start_time >= (time_t) MY_TIME_T_MAX) - { - sql_print_error("This MySQL server doesn't support dates later then 2038"); - return 1; - } rpl_filter= new Rpl_filter; binlog_filter= new Rpl_filter; @@ -3124,6 +3118,13 @@ static int init_common_variables() */ mysql_bin_log.init_pthread_objects(); + /* TODO: remove this when my_time_t is 64 bit compatible */ + if (!IS_TIME_T_VALID_FOR_TIMESTAMP(server_start_time)) + { + sql_print_error("This MySQL server doesn't support dates later then 2038"); + return 1; + } + if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0) { strmake(glob_hostname, STRING_WITH_LEN("localhost")); diff --git a/sql/sql_class.h b/sql/sql_class.h index 8b05497388e..137a0c48ead 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2280,7 +2280,7 @@ public: /*TODO: this will be obsolete when we have support for 64 bit my_time_t */ inline bool is_valid_time() { - return (start_time < (time_t) MY_TIME_T_MAX); + return (IS_TIME_T_VALID_FOR_TIMESTAMP(start_time)); } void set_time_after_lock() { utime_after_lock= my_micro_time(); } ulonglong current_utime() { return my_micro_time(); } diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 68bb77d467f..ce1dcb4a33c 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2430,17 +2430,17 @@ static ulonglong read_timestamp(THD *thd) static bool check_timestamp(sys_var *self, THD *thd, set_var *var) { - time_t val; + longlong val; if (!var->value) return FALSE; - val= (time_t) var->save_result.ulonglong_value; - if (val < (time_t) MY_TIME_T_MIN || val > (time_t) MY_TIME_T_MAX) + val= (longlong) var->save_result.ulonglong_value; + if (val != 0 && // this is how you set the default value + (val < TIMESTAMP_MIN_VALUE || val > TIMESTAMP_MAX_VALUE)) { - my_message(ER_UNKNOWN_ERROR, - "This version of MySQL doesn't support dates later than 2038", - MYF(0)); + char buf[64]; + my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "timestamp", llstr(val, buf)); return TRUE; } return FALSE; |