Commit 821591db authored by unknown's avatar unknown

Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1

into gw.mysql.r18.ru:/usr/home/ram/work/4.1.b3728
parents b98a4659 d0fa6b70
...@@ -35,6 +35,12 @@ Table Op Msg_type Msg_text ...@@ -35,6 +35,12 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
delete from t1; 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"); 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; select * from t1;
t t
2000-01-01 00:00:00 2000-01-01 00:00:00
......
...@@ -3930,6 +3930,11 @@ void Field_newdate::sql_type(String &res) const ...@@ -3930,6 +3930,11 @@ void Field_newdate::sql_type(String &res) const
int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs) int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
{ {
longlong tmp=str_to_datetime(from,len,1); 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 #ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first) if (table->db_low_byte_first)
{ {
......
...@@ -663,11 +663,25 @@ time_t str_to_timestamp(const char *str,uint length) ...@@ -663,11 +663,25 @@ time_t str_to_timestamp(const char *str,uint length)
} }
/*
Convert a string to datetime.
SYNOPSIS
str_to_datetime()
str String to parse (see str_to_TIME() synopsis)
length Length of str
fuzzy_date Flags (see str_to_TIME() synopsis)
RETURN
-1 if error
datetime value otherwise
*/
longlong str_to_datetime(const char *str,uint length, uint fuzzy_date) longlong str_to_datetime(const char *str,uint length, uint fuzzy_date)
{ {
TIME l_time; TIME l_time;
if (str_to_TIME(str,length,&l_time,fuzzy_date) <= TIMESTAMP_DATETIME_ERROR) if (str_to_TIME(str,length,&l_time,fuzzy_date) <= TIMESTAMP_DATETIME_ERROR)
return(0); return -1;
return (longlong) (l_time.year*LL(10000000000) + return (longlong) (l_time.year*LL(10000000000) +
l_time.month*LL(100000000)+ l_time.month*LL(100000000)+
l_time.day*LL(1000000)+ l_time.day*LL(1000000)+
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment