summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2005-06-28 03:20:00 -0700
committerunknown <igor@rurik.mysql.com>2005-06-28 03:20:00 -0700
commit27478af9d562f8c0269004344da0a52be0bd4359 (patch)
treeaafa9caa64c34f34454ad3eb07a43d81a6cf8d4a /sql/field.cc
parent2776aa35b7abc4c0f742eaa94c04b4072e2ba83d (diff)
parent3f499c32d44005906ad08c34011fbe96c598230a (diff)
downloadmariadb-git-27478af9d562f8c0269004344da0a52be0bd4359.tar.gz
Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-4.1
into rurik.mysql.com:/home/igor/mysql-4.1 sql/field.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc41
1 files changed, 24 insertions, 17 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 88816151c10..64d5babd159 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -2480,7 +2480,10 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
if (error ||
(from+len != end && table->in_use->count_cuted_fields &&
!test_if_int(from,len,end,cs)))
- error= 1;
+ {
+ if (error != 1)
+ error= 2;
+ }
#if SIZEOF_LONG > 4
if (unsigned_flag)
{
@@ -2508,10 +2511,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
}
#endif
if (error)
- {
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
- error= 1;
- }
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)
{
@@ -2777,8 +2777,11 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
(from+len != end && table->in_use->count_cuted_fields &&
!test_if_int(from,len,end,cs)))
{
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
- error= 1;
+ if (error != 1)
+ {
+ set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
+ error= 2;
+ }
}
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)
@@ -2998,7 +3001,7 @@ int Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
double nr= my_strntod(cs,(char*) from,len,&end,&error);
if (error || ((uint) (end-from) != len && table->in_use->count_cuted_fields))
{
- error= 1;
+ error= 2;
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
}
Field_float::store(nr);
@@ -3284,7 +3287,7 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
double nr= my_strntod(cs,(char*) from, len, &end, &error);
if (error || ((uint) (end-from) != len && table->in_use->count_cuted_fields))
{
- error= 1;
+ error= 2;
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
}
Field_double::store(nr);
@@ -3666,6 +3669,8 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
error= 1;
}
}
+ if (error > 1)
+ error= 2;
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)
@@ -3954,7 +3959,7 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
if (str_to_time(from, len, &ltime, &error))
{
tmp=0L;
- error= 1;
+ error= 2;
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED,
from, len, MYSQL_TIMESTAMP_TIME, 1);
}
@@ -3976,6 +3981,8 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
from, len, MYSQL_TIMESTAMP_TIME, !error);
error= 1;
}
+ if (error > 1)
+ error= 2;
}
if (ltime.neg)
@@ -4305,7 +4312,7 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
if (str_to_datetime(from, len, &l_time, 1, &error) <= MYSQL_TIMESTAMP_ERROR)
{
tmp=0;
- error= 1;
+ error= 2;
}
else
tmp=(uint32) l_time.year*10000L + (uint32) (l_time.month*100+l_time.day);
@@ -4496,7 +4503,7 @@ int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
if (str_to_datetime(from, len, &l_time, 1, &error) <= MYSQL_TIMESTAMP_ERROR)
{
tmp=0L;
- error= 1;
+ error= 2;
}
else
tmp= l_time.day + l_time.month*32 + l_time.year*16*32;
@@ -4938,7 +4945,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
from= tmpstr.ptr();
length= tmpstr.length();
if (conv_errors)
- error= 1;
+ error= 2;
}
/*
@@ -4962,7 +4969,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
from+= field_charset->cset->scan(field_charset, from, end,
MY_SEQ_SPACES);
if (from != end)
- error= 1;
+ error= 2;
}
if (error)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
@@ -5217,12 +5224,12 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
from= tmpstr.ptr();
length= tmpstr.length();
if (conv_errors)
- error= 1;
+ error= 2;
}
if (length > field_length)
{
length=field_length;
- error= 1;
+ error= 2;
}
if (error)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
@@ -5575,7 +5582,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
from= tmpstr.ptr();
length= tmpstr.length();
if (conv_errors)
- error= 1;
+ error= 2;
}
copy_length= max_data_length();
@@ -5590,7 +5597,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
copy_length,
&well_formed_error);
if (copy_length < length)
- error= 1;
+ error= 2;
Field_blob::store_length(copy_length);
if (was_conversion || table->copy_blobs || copy_length <= MAX_FIELD_WIDTH)
{ // Must make a copy