diff options
author | Michael Widenius <monty@askmonty.org> | 2011-06-11 12:04:42 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-06-11 12:04:42 +0300 |
commit | 9f6f04360ab80ab1b104ef8e660c7ccffde28601 (patch) | |
tree | 7e281fb508fa87bddefb3aa7b30722cb979f1056 /sql/set_var.cc | |
parent | e5403ec95a82002ff30b74fd8d556a1641426d31 (diff) | |
parent | 49874ff827bdbc33cb0be677b6262e8f7784f69b (diff) | |
download | mariadb-git-9f6f04360ab80ab1b104ef8e660c7ccffde28601.tar.gz |
Merge with Sergei's tree to get in latest microsecond patches and also fixes to innodb_plugin.
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index 745848a16ab..85722f3d64a 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -2900,14 +2900,20 @@ int set_var_collation_client::update(THD *thd) bool sys_var_timestamp::check(THD *thd, set_var *var) { - double val= var->value->val_real(); - if (val < 0 || val > MY_TIME_T_MAX) + ulonglong sec; + ulong sec_part; + char buf[64], *errval= 0; + if (var->value->get_seconds(&sec, &sec_part)) + errval= llstr(sec, buf); + else if (sec > TIMESTAMP_MAX_VALUE) + errval= ullstr(sec, buf); + + if (errval) { - char buf[64]; - my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "timestamp", llstr((longlong)val, buf)); + my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "timestamp", errval); return TRUE; } - var->save_result.ulonglong_value= hrtime_from_time(val); + var->save_result.ulonglong_value= hrtime_from_time(sec)+sec_part; return FALSE; } |