diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-06-17 17:31:51 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-06-17 17:31:51 +0400 |
commit | cc6dabba377bd05bb9a6a9ffaa985bbe5e38bcc1 (patch) | |
tree | 9413ba739bc0dbf1e647293756a3503f17dcde07 /sql/sys_vars.cc | |
parent | 91a7b147056a228804f81726127035aa305702ff (diff) | |
parent | 45c7bf3c54fa852b312773688fdce15bffe49abf (diff) | |
download | mariadb-git-cc6dabba377bd05bb9a6a9ffaa985bbe5e38bcc1.tar.gz |
Merge trunk-bugfixing -> trunk-runtime
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r-- | sql/sys_vars.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index e829d0784e9..7eb9a72273b 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2393,12 +2393,33 @@ static ulonglong read_timestamp(THD *thd) { return (ulonglong) thd->start_time; } + + +static bool check_timestamp(sys_var *self, THD *thd, set_var *var) +{ + time_t 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) + { + my_message(ER_UNKNOWN_ERROR, + "This version of MySQL doesn't support dates later than 2038", + MYF(0)); + return TRUE; + } + return FALSE; +} + + static Sys_var_session_special Sys_timestamp( "timestamp", "Set the time for this client", sys_var::ONLY_SESSION, NO_CMD_LINE, VALID_RANGE(0, ~(time_t)0), BLOCK_SIZE(1), - NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0), ON_UPDATE(update_timestamp), - ON_READ(read_timestamp)); + NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_timestamp), + ON_UPDATE(update_timestamp), ON_READ(read_timestamp)); static bool update_last_insert_id(THD *thd, set_var *var) { |