A fix (Bug #3728: Missing warning in 4.1).

This commit is contained in:
ram@gw.mysql.r18.ru 2004-05-18 12:16:00 +05:00
parent a79a3f5724
commit 0f3ab4174e
3 changed files with 12 additions and 1 deletions

View file

@ -35,6 +35,12 @@ Table Op Msg_type Msg_text
test.t1 check status OK
delete from t1;
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
Warnings:
Warning 1264 Data truncated, out of range for column 't' at row 14
Warning 1264 Data truncated, out of range for column 't' at row 15
Warning 1264 Data truncated, out of range for column 't' at row 16
Warning 1264 Data truncated, out of range for column 't' at row 17
Warning 1264 Data truncated, out of range for column 't' at row 18
select * from t1;
t
2000-01-01 00:00:00

View file

@ -3930,6 +3930,11 @@ void Field_newdate::sql_type(String &res) const
int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
{
longlong tmp=str_to_datetime(from,len,1);
if (tmp < 0)
{
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
tmp= 0;
}
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)
{

View file

@ -667,7 +667,7 @@ longlong str_to_datetime(const char *str,uint length, uint fuzzy_date)
{
TIME l_time;
if (str_to_TIME(str,length,&l_time,fuzzy_date) <= TIMESTAMP_DATETIME_ERROR)
return(0);
return -1;
return (longlong) (l_time.year*LL(10000000000) +
l_time.month*LL(100000000)+
l_time.day*LL(1000000)+