diff options
author | unknown <monty@mysql.com> | 2005-01-03 23:04:52 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-01-03 23:04:52 +0200 |
commit | 73c9909750c7e471a08ce90ccc130d80394b049a (patch) | |
tree | 0f73878fcf058ff862f3f7eb305aafae2ad3465d /sql/item_timefunc.cc | |
parent | 57deb768672132dc7ee461ca9a1e65435f36037a (diff) | |
parent | a75e31b3610c2fb6a16f2bae469367e4be78d1cb (diff) | |
download | mariadb-git-73c9909750c7e471a08ce90ccc130d80394b049a.tar.gz |
Merge with 4.1 tree to get fix for INSERT IGNORE ... ON DUPLICATE KEY
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
Makefile.am:
Auto merged
client/mysqltest.c:
Auto merged
configure.in:
Auto merged
innobase/log/log0recv.c:
Auto merged
myisam/mi_check.c:
Auto merged
mysql-test/r/cast.result:
Auto merged
mysql-test/r/drop.result:
Auto merged
mysql-test/r/func_time.result:
Auto merged
mysql-test/r/ps_2myisam.result:
Auto merged
mysql-test/r/ps_3innodb.result:
Auto merged
mysql-test/r/ps_4heap.result:
Auto merged
mysql-test/r/ps_5merge.result:
Auto merged
mysql-test/r/ps_6bdb.result:
Auto merged
mysql-test/r/ps_7ndb.result:
Auto merged
mysql-test/r/type_datetime.result:
Auto merged
mysql-test/t/drop.test:
Auto merged
mysql-test/t/func_time.test:
Auto merged
ndb/include/ndb_global.h.in:
Auto merged
ndb/src/kernel/blocks/suma/Suma.cpp:
Auto merged
sql/ha_ndbcluster.h:
Auto merged
sql/item_timefunc.h:
Auto merged
sql/log_event.cc:
Auto merged
sql/log_event.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_repl.cc:
Auto merged
sql/sql_repl.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql-common/my_time.c:
Auto merged
sql/sql_union.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/time.cc:
Auto merged
innobase/row/row0upd.c:
Trivial merge
mysql-test/t/func_concat.test:
Keep local code
mysql-test/t/multi_update.test:
auto merge
sql/ha_ndbcluster.cc:
manual merge
sql/item_timefunc.cc:
manual merge
sql/mysql_priv.h:
manual merge
sql/sql_class.h:
manual merge
sql/sql_delete.cc:
manual merge
sql/sql_insert.cc:
manual merge
sql/sql_lex.cc:
manual merge
sql/sql_lex.h:
manual merge
sql/sql_load.cc:
manual merge
sql/sql_parse.cc:
manual merge
sql/sql_table.cc:
manual merge
sql/sql_update.cc:
manual merge
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 27c000138d8..2d0e5d7632f 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1603,6 +1603,7 @@ void Item_func_from_unixtime::fix_length_and_dec() collation.set(&my_charset_bin); decimals=0; max_length=MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; + maybe_null= 1; thd->time_zone_used= 1; } @@ -1642,11 +1643,12 @@ longlong Item_func_from_unixtime::val_int() bool Item_func_from_unixtime::get_date(TIME *ltime, uint fuzzy_date __attribute__((unused))) { - longlong tmp= args[0]->val_int(); - - if ((null_value= (args[0]->null_value || - tmp < TIMESTAMP_MIN_VALUE || - tmp > TIMESTAMP_MAX_VALUE))) + ulonglong tmp= (ulonglong)(args[0]->val_int()); + /* + "tmp > TIMESTAMP_MAX_VALUE" check also covers case of negative + from_unixtime() argument since tmp is unsigned. + */ + if ((null_value= (args[0]->null_value || tmp > TIMESTAMP_MAX_VALUE))) return 1; thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)tmp); @@ -2202,6 +2204,12 @@ String *Item_datetime_typecast::val_str(String *str) bool Item_time_typecast::get_time(TIME *ltime) { bool res= get_arg0_time(ltime); + /* + For MYSQL_TIMESTAMP_TIME value we can have non-zero day part, + which we should not lose. + */ + if (ltime->time_type == MYSQL_TIMESTAMP_DATETIME) + ltime->year= ltime->month= ltime->day= 0; ltime->time_type= MYSQL_TIMESTAMP_TIME; return res; } @@ -2225,6 +2233,7 @@ String *Item_time_typecast::val_str(String *str) bool Item_date_typecast::get_date(TIME *ltime, uint fuzzy_date) { bool res= get_arg0_date(ltime, TIME_FUZZY_DATE); + ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0; ltime->time_type= MYSQL_TIMESTAMP_DATE; return res; } |