Support of warnings for all DML statements (Insert, Update and Alter)
Fix LOAD DATA INFILE warnings to have a better meanigful messages Fix to make the mysql command line to automatically show the warnings count for all basic commands
This commit is contained in:
parent
23a522c026
commit
eb137c063c
@ -277,7 +277,8 @@
|
|||||||
#define ER_CUT_VALUE_GROUP_CONCAT 1258
|
#define ER_CUT_VALUE_GROUP_CONCAT 1258
|
||||||
#define ER_WARN_TOO_FEW_RECORDS 1259
|
#define ER_WARN_TOO_FEW_RECORDS 1259
|
||||||
#define ER_WARN_TOO_MANY_RECORDS 1260
|
#define ER_WARN_TOO_MANY_RECORDS 1260
|
||||||
#define ER_WARN_DATA_TRUNCATED 1261
|
#define ER_WARN_NULL_TO_NOTNULL 1261
|
||||||
#define ER_WARN_NULL_TO_NOTNULL 1262
|
#define ER_WARN_DATA_OUT_OF_RANGE 1262
|
||||||
#define ER_ERROR_MESSAGES 263
|
#define ER_WARN_DATA_TRUNCATED 1263
|
||||||
|
#define ER_ERROR_MESSAGES 264
|
||||||
|
|
||||||
|
233
sql/field.cc
233
sql/field.cc
@ -367,7 +367,7 @@ void Field_decimal::overflow(bool negative)
|
|||||||
uint len=field_length;
|
uint len=field_length;
|
||||||
char *to=ptr, filler= '9';
|
char *to=ptr, filler= '9';
|
||||||
|
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
if (negative)
|
if (negative)
|
||||||
{
|
{
|
||||||
if (!unsigned_flag)
|
if (!unsigned_flag)
|
||||||
@ -477,7 +477,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
|||||||
from++;
|
from++;
|
||||||
if (from == end)
|
if (from == end)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
is_cuted_fields_incr=1;
|
is_cuted_fields_incr=1;
|
||||||
}
|
}
|
||||||
else if (*from == '+' || *from == '-') // Found some sign ?
|
else if (*from == '+' || *from == '-') // Found some sign ?
|
||||||
@ -553,7 +553,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
|||||||
for (;from != end && my_isspace(&my_charset_bin, *from); from++) ;
|
for (;from != end && my_isspace(&my_charset_bin, *from); from++) ;
|
||||||
if (from != end) // If still something left, warn
|
if (from != end) // If still something left, warn
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
is_cuted_fields_incr=1;
|
is_cuted_fields_incr=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -731,7 +731,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
|||||||
if (tmp_char != '0') // Losing a non zero digit ?
|
if (tmp_char != '0') // Losing a non zero digit ?
|
||||||
{
|
{
|
||||||
if (!is_cuted_fields_incr)
|
if (!is_cuted_fields_incr)
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -748,7 +748,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
|||||||
if (tmp_char != '0') // Losing a non zero digit ?
|
if (tmp_char != '0') // Losing a non zero digit ?
|
||||||
{
|
{
|
||||||
if (!is_cuted_fields_incr)
|
if (!is_cuted_fields_incr)
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -966,18 +966,18 @@ int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
if (tmp < 0)
|
if (tmp < 0)
|
||||||
{
|
{
|
||||||
tmp=0; /* purecov: inspected */
|
tmp=0; /* purecov: inspected */
|
||||||
current_thd->cuted_fields++; /* purecov: inspected */
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (tmp > 255)
|
else if (tmp > 255)
|
||||||
{
|
{
|
||||||
tmp= 255;
|
tmp= 255;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -986,18 +986,18 @@ int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
if (tmp < -128)
|
if (tmp < -128)
|
||||||
{
|
{
|
||||||
tmp= -128;
|
tmp= -128;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (tmp >= 128)
|
else if (tmp >= 128)
|
||||||
{
|
{
|
||||||
tmp= 127;
|
tmp= 127;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1015,13 +1015,13 @@ int Field_tiny::store(double nr)
|
|||||||
if (nr < 0.0)
|
if (nr < 0.0)
|
||||||
{
|
{
|
||||||
*ptr=0;
|
*ptr=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > 255.0)
|
else if (nr > 255.0)
|
||||||
{
|
{
|
||||||
*ptr=(char) 255;
|
*ptr=(char) 255;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1032,13 +1032,13 @@ int Field_tiny::store(double nr)
|
|||||||
if (nr < -128.0)
|
if (nr < -128.0)
|
||||||
{
|
{
|
||||||
*ptr= (char) -128;
|
*ptr= (char) -128;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > 127.0)
|
else if (nr > 127.0)
|
||||||
{
|
{
|
||||||
*ptr=127;
|
*ptr=127;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1055,13 +1055,13 @@ int Field_tiny::store(longlong nr)
|
|||||||
if (nr < 0L)
|
if (nr < 0L)
|
||||||
{
|
{
|
||||||
*ptr=0;
|
*ptr=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > 255L)
|
else if (nr > 255L)
|
||||||
{
|
{
|
||||||
*ptr= (char) 255;
|
*ptr= (char) 255;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1072,13 +1072,13 @@ int Field_tiny::store(longlong nr)
|
|||||||
if (nr < -128L)
|
if (nr < -128L)
|
||||||
{
|
{
|
||||||
*ptr= (char) -128;
|
*ptr= (char) -128;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > 127L)
|
else if (nr > 127L)
|
||||||
{
|
{
|
||||||
*ptr=127;
|
*ptr=127;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1168,18 +1168,18 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
if (tmp < 0)
|
if (tmp < 0)
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (tmp > (uint16) ~0)
|
else if (tmp > (uint16) ~0)
|
||||||
{
|
{
|
||||||
tmp=(uint16) ~0;
|
tmp=(uint16) ~0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1188,18 +1188,18 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
if (tmp < INT_MIN16)
|
if (tmp < INT_MIN16)
|
||||||
{
|
{
|
||||||
tmp= INT_MIN16;
|
tmp= INT_MIN16;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (tmp > INT_MAX16)
|
else if (tmp > INT_MAX16)
|
||||||
{
|
{
|
||||||
tmp=INT_MAX16;
|
tmp=INT_MAX16;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1225,13 +1225,13 @@ int Field_short::store(double nr)
|
|||||||
if (nr < 0)
|
if (nr < 0)
|
||||||
{
|
{
|
||||||
res=0;
|
res=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > (double) (uint16) ~0)
|
else if (nr > (double) (uint16) ~0)
|
||||||
{
|
{
|
||||||
res=(int16) (uint16) ~0;
|
res=(int16) (uint16) ~0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1242,13 +1242,13 @@ int Field_short::store(double nr)
|
|||||||
if (nr < (double) INT_MIN16)
|
if (nr < (double) INT_MIN16)
|
||||||
{
|
{
|
||||||
res=INT_MIN16;
|
res=INT_MIN16;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > (double) INT_MAX16)
|
else if (nr > (double) INT_MAX16)
|
||||||
{
|
{
|
||||||
res=INT_MAX16;
|
res=INT_MAX16;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1274,13 +1274,13 @@ int Field_short::store(longlong nr)
|
|||||||
if (nr < 0L)
|
if (nr < 0L)
|
||||||
{
|
{
|
||||||
res=0;
|
res=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > (longlong) (uint16) ~0)
|
else if (nr > (longlong) (uint16) ~0)
|
||||||
{
|
{
|
||||||
res=(int16) (uint16) ~0;
|
res=(int16) (uint16) ~0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1291,13 +1291,13 @@ int Field_short::store(longlong nr)
|
|||||||
if (nr < INT_MIN16)
|
if (nr < INT_MIN16)
|
||||||
{
|
{
|
||||||
res=INT_MIN16;
|
res=INT_MIN16;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > INT_MAX16)
|
else if (nr > INT_MAX16)
|
||||||
{
|
{
|
||||||
res=INT_MAX16;
|
res=INT_MAX16;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1442,18 +1442,18 @@ int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
if (tmp < 0)
|
if (tmp < 0)
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (tmp >= (long) (1L << 24))
|
else if (tmp >= (long) (1L << 24))
|
||||||
{
|
{
|
||||||
tmp=(long) (1L << 24)-1L;
|
tmp=(long) (1L << 24)-1L;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1462,18 +1462,18 @@ int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
if (tmp < INT_MIN24)
|
if (tmp < INT_MIN24)
|
||||||
{
|
{
|
||||||
tmp= INT_MIN24;
|
tmp= INT_MIN24;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (tmp > INT_MAX24)
|
else if (tmp > INT_MAX24)
|
||||||
{
|
{
|
||||||
tmp=INT_MAX24;
|
tmp=INT_MAX24;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1492,14 +1492,14 @@ int Field_medium::store(double nr)
|
|||||||
if (nr < 0)
|
if (nr < 0)
|
||||||
{
|
{
|
||||||
int3store(ptr,0);
|
int3store(ptr,0);
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr >= (double) (long) (1L << 24))
|
else if (nr >= (double) (long) (1L << 24))
|
||||||
{
|
{
|
||||||
uint32 tmp=(uint32) (1L << 24)-1L;
|
uint32 tmp=(uint32) (1L << 24)-1L;
|
||||||
int3store(ptr,tmp);
|
int3store(ptr,tmp);
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1511,14 +1511,14 @@ int Field_medium::store(double nr)
|
|||||||
{
|
{
|
||||||
long tmp=(long) INT_MIN24;
|
long tmp=(long) INT_MIN24;
|
||||||
int3store(ptr,tmp);
|
int3store(ptr,tmp);
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > (double) INT_MAX24)
|
else if (nr > (double) INT_MAX24)
|
||||||
{
|
{
|
||||||
long tmp=(long) INT_MAX24;
|
long tmp=(long) INT_MAX24;
|
||||||
int3store(ptr,tmp);
|
int3store(ptr,tmp);
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1535,14 +1535,14 @@ int Field_medium::store(longlong nr)
|
|||||||
if (nr < 0L)
|
if (nr < 0L)
|
||||||
{
|
{
|
||||||
int3store(ptr,0);
|
int3store(ptr,0);
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr >= (longlong) (long) (1L << 24))
|
else if (nr >= (longlong) (long) (1L << 24))
|
||||||
{
|
{
|
||||||
long tmp=(long) (1L << 24)-1L;;
|
long tmp=(long) (1L << 24)-1L;;
|
||||||
int3store(ptr,tmp);
|
int3store(ptr,tmp);
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1554,14 +1554,14 @@ int Field_medium::store(longlong nr)
|
|||||||
{
|
{
|
||||||
long tmp=(long) INT_MIN24;
|
long tmp=(long) INT_MIN24;
|
||||||
int3store(ptr,tmp);
|
int3store(ptr,tmp);
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > (longlong) INT_MAX24)
|
else if (nr > (longlong) INT_MAX24)
|
||||||
{
|
{
|
||||||
long tmp=(long) INT_MAX24;
|
long tmp=(long) INT_MAX24;
|
||||||
int3store(ptr,tmp);
|
int3store(ptr,tmp);
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1676,7 +1676,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
(from+len != end && current_thd->count_cuted_fields &&
|
(from+len != end && current_thd->count_cuted_fields &&
|
||||||
!test_if_int(from,len,end,cs)))
|
!test_if_int(from,len,end,cs)))
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
@ -1701,13 +1701,13 @@ int Field_long::store(double nr)
|
|||||||
if (nr < 0)
|
if (nr < 0)
|
||||||
{
|
{
|
||||||
res=0;
|
res=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > (double) (ulong) ~0L)
|
else if (nr > (double) (ulong) ~0L)
|
||||||
{
|
{
|
||||||
res=(int32) (uint32) ~0L;
|
res=(int32) (uint32) ~0L;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1718,13 +1718,13 @@ int Field_long::store(double nr)
|
|||||||
if (nr < (double) INT_MIN32)
|
if (nr < (double) INT_MIN32)
|
||||||
{
|
{
|
||||||
res=(int32) INT_MIN32;
|
res=(int32) INT_MIN32;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > (double) INT_MAX32)
|
else if (nr > (double) INT_MAX32)
|
||||||
{
|
{
|
||||||
res=(int32) INT_MAX32;
|
res=(int32) INT_MAX32;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1751,13 +1751,13 @@ int Field_long::store(longlong nr)
|
|||||||
if (nr < 0)
|
if (nr < 0)
|
||||||
{
|
{
|
||||||
res=0;
|
res=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr >= (LL(1) << 32))
|
else if (nr >= (LL(1) << 32))
|
||||||
{
|
{
|
||||||
res=(int32) (uint32) ~0L;
|
res=(int32) (uint32) ~0L;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1768,13 +1768,13 @@ int Field_long::store(longlong nr)
|
|||||||
if (nr < (longlong) INT_MIN32)
|
if (nr < (longlong) INT_MIN32)
|
||||||
{
|
{
|
||||||
res=(int32) INT_MIN32;
|
res=(int32) INT_MIN32;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > (longlong) INT_MAX32)
|
else if (nr > (longlong) INT_MAX32)
|
||||||
{
|
{
|
||||||
res=(int32) INT_MAX32;
|
res=(int32) INT_MAX32;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1934,7 +1934,7 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
(from+len != end && current_thd->count_cuted_fields &&
|
(from+len != end && current_thd->count_cuted_fields &&
|
||||||
!test_if_int(from,len,end,cs)))
|
!test_if_int(from,len,end,cs)))
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
@ -1959,13 +1959,13 @@ int Field_longlong::store(double nr)
|
|||||||
if (nr < 0)
|
if (nr < 0)
|
||||||
{
|
{
|
||||||
res=0;
|
res=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr >= (double) ~ (ulonglong) 0)
|
else if (nr >= (double) ~ (ulonglong) 0)
|
||||||
{
|
{
|
||||||
res= ~(longlong) 0;
|
res= ~(longlong) 0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1976,13 +1976,13 @@ int Field_longlong::store(double nr)
|
|||||||
if (nr <= (double) LONGLONG_MIN)
|
if (nr <= (double) LONGLONG_MIN)
|
||||||
{
|
{
|
||||||
res=(longlong) LONGLONG_MIN;
|
res=(longlong) LONGLONG_MIN;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr >= (double) LONGLONG_MAX)
|
else if (nr >= (double) LONGLONG_MAX)
|
||||||
{
|
{
|
||||||
res=(longlong) LONGLONG_MAX;
|
res=(longlong) LONGLONG_MAX;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2146,7 +2146,7 @@ int Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
Field_float::store(my_strntod(cs,(char*) from,len,(char**)NULL,&err));
|
Field_float::store(my_strntod(cs,(char*) from,len,(char**)NULL,&err));
|
||||||
if (err || current_thd->count_cuted_fields && !test_if_real(from,len,cs))
|
if (err || current_thd->count_cuted_fields && !test_if_real(from,len,cs))
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return (err) ? 1 : 0;
|
return (err) ? 1 : 0;
|
||||||
@ -2161,20 +2161,20 @@ int Field_float::store(double nr)
|
|||||||
nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point
|
nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point
|
||||||
if (unsigned_flag && nr < 0)
|
if (unsigned_flag && nr < 0)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
nr=0;
|
nr=0;
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
if (nr < -FLT_MAX)
|
if (nr < -FLT_MAX)
|
||||||
{
|
{
|
||||||
j= -FLT_MAX;
|
j= -FLT_MAX;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr > FLT_MAX)
|
else if (nr > FLT_MAX)
|
||||||
{
|
{
|
||||||
j=FLT_MAX;
|
j=FLT_MAX;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2197,7 +2197,7 @@ int Field_float::store(longlong nr)
|
|||||||
float j= (float) nr;
|
float j= (float) nr;
|
||||||
if (unsigned_flag && j < 0)
|
if (unsigned_flag && j < 0)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
j=0;
|
j=0;
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
@ -2419,12 +2419,12 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
double j= my_strntod(cs,(char*) from,len,(char**)0,&err);
|
double j= my_strntod(cs,(char*) from,len,(char**)0,&err);
|
||||||
if (err || current_thd->count_cuted_fields && !test_if_real(from,len,cs))
|
if (err || current_thd->count_cuted_fields && !test_if_real(from,len,cs))
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
err= 1;
|
err= 1;
|
||||||
}
|
}
|
||||||
if (unsigned_flag && j < 0)
|
if (unsigned_flag && j < 0)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
j=0;
|
j=0;
|
||||||
err= 1;
|
err= 1;
|
||||||
}
|
}
|
||||||
@ -2447,7 +2447,7 @@ int Field_double::store(double nr)
|
|||||||
nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point
|
nr=floor(nr*log_10[dec]+0.5)/log_10[dec]; // To fixed point
|
||||||
if (unsigned_flag && nr < 0)
|
if (unsigned_flag && nr < 0)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
nr=0;
|
nr=0;
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
@ -2469,7 +2469,7 @@ int Field_double::store(longlong nr)
|
|||||||
int error= 0;
|
int error= 0;
|
||||||
if (unsigned_flag && j < 0)
|
if (unsigned_flag && j < 0)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
j=0;
|
j=0;
|
||||||
}
|
}
|
||||||
@ -2710,7 +2710,7 @@ int Field_timestamp::store(double nr)
|
|||||||
if (nr < 0 || nr > 99991231235959.0)
|
if (nr < 0 || nr > 99991231235959.0)
|
||||||
{
|
{
|
||||||
nr= 0; // Avoid overflow on buff
|
nr= 0; // Avoid overflow on buff
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
error|= Field_timestamp::store((longlong) rint(nr));
|
error|= Field_timestamp::store((longlong) rint(nr));
|
||||||
@ -2726,6 +2726,7 @@ int Field_timestamp::store(double nr)
|
|||||||
|
|
||||||
static longlong fix_datetime(longlong nr)
|
static longlong fix_datetime(longlong nr)
|
||||||
{
|
{
|
||||||
|
current_thd->last_cuted_field= 0;
|
||||||
if (nr == LL(0) || nr >= LL(10000101000000))
|
if (nr == LL(0) || nr >= LL(10000101000000))
|
||||||
return nr; // Normal datetime >= Year 1000
|
return nr; // Normal datetime >= Year 1000
|
||||||
if (nr < 101)
|
if (nr < 101)
|
||||||
@ -2750,7 +2751,7 @@ static longlong fix_datetime(longlong nr)
|
|||||||
return nr+LL(19000000000000); // YYMMDDHHMMSS, 1970-1999
|
return nr+LL(19000000000000); // YYMMDDHHMMSS, 1970-1999
|
||||||
|
|
||||||
err:
|
err:
|
||||||
current_thd->cuted_fields++;
|
current_thd->last_cuted_field= 1;
|
||||||
return LL(0);
|
return LL(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2783,6 +2784,8 @@ int Field_timestamp::store(longlong nr)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
longstore(ptr,(uint32) timestamp);
|
longstore(ptr,(uint32) timestamp);
|
||||||
|
if (current_thd->last_cuted_field)
|
||||||
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3026,6 +3029,7 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
{
|
{
|
||||||
tmp=0L;
|
tmp=0L;
|
||||||
error= 1;
|
error= 1;
|
||||||
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3035,7 +3039,7 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
if (tmp > 8385959)
|
if (tmp > 8385959)
|
||||||
{
|
{
|
||||||
tmp=8385959;
|
tmp=8385959;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3053,13 +3057,13 @@ int Field_time::store(double nr)
|
|||||||
if (nr > 8385959.0)
|
if (nr > 8385959.0)
|
||||||
{
|
{
|
||||||
tmp=8385959L;
|
tmp=8385959L;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr < -8385959.0)
|
else if (nr < -8385959.0)
|
||||||
{
|
{
|
||||||
tmp= -8385959L;
|
tmp= -8385959L;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3070,7 +3074,7 @@ int Field_time::store(double nr)
|
|||||||
if (tmp % 100 > 59 || tmp/100 % 100 > 59)
|
if (tmp % 100 > 59 || tmp/100 % 100 > 59)
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3086,13 +3090,13 @@ int Field_time::store(longlong nr)
|
|||||||
if (nr > (longlong) 8385959L)
|
if (nr > (longlong) 8385959L)
|
||||||
{
|
{
|
||||||
tmp=8385959L;
|
tmp=8385959L;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else if (nr < (longlong) -8385959L)
|
else if (nr < (longlong) -8385959L)
|
||||||
{
|
{
|
||||||
tmp= -8385959L;
|
tmp= -8385959L;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3101,7 +3105,7 @@ int Field_time::store(longlong nr)
|
|||||||
if (tmp % 100 > 59 || tmp/100 % 100 > 59)
|
if (tmp % 100 > 59 || tmp/100 % 100 > 59)
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3209,11 +3213,11 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
|
|||||||
if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155)
|
if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155)
|
||||||
{
|
{
|
||||||
*ptr=0;
|
*ptr=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
if (nr != 0 || len != 4)
|
if (nr != 0 || len != 4)
|
||||||
{
|
{
|
||||||
if (nr < YY_PART_YEAR)
|
if (nr < YY_PART_YEAR)
|
||||||
@ -3241,7 +3245,7 @@ int Field_year::store(longlong nr)
|
|||||||
if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155)
|
if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155)
|
||||||
{
|
{
|
||||||
*ptr=0;
|
*ptr=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (nr != 0 || field_length != 4) // 0000 -> 0; 00 -> 2000
|
if (nr != 0 || field_length != 4) // 0000 -> 0; 00 -> 2000
|
||||||
@ -3310,6 +3314,7 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
|
|||||||
{
|
{
|
||||||
tmp=0;
|
tmp=0;
|
||||||
error= 1;
|
error= 1;
|
||||||
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tmp=(uint32) l_time.year*10000L + (uint32) (l_time.month*100+l_time.day);
|
tmp=(uint32) l_time.year*10000L + (uint32) (l_time.month*100+l_time.day);
|
||||||
@ -3334,7 +3339,7 @@ int Field_date::store(double nr)
|
|||||||
if (nr < 0.0 || nr > 99991231.0)
|
if (nr < 0.0 || nr > 99991231.0)
|
||||||
{
|
{
|
||||||
tmp=0L;
|
tmp=0L;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3360,7 +3365,7 @@ int Field_date::store(longlong nr)
|
|||||||
if (nr < 0 || nr > LL(99991231))
|
if (nr < 0 || nr > LL(99991231))
|
||||||
{
|
{
|
||||||
tmp=0L;
|
tmp=0L;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3489,6 +3494,7 @@ int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||||||
{
|
{
|
||||||
tmp=0L;
|
tmp=0L;
|
||||||
error= 1;
|
error= 1;
|
||||||
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tmp= l_time.day + l_time.month*32 + l_time.year*16*32;
|
tmp= l_time.day + l_time.month*32 + l_time.year*16*32;
|
||||||
@ -3501,6 +3507,7 @@ int Field_newdate::store(double nr)
|
|||||||
if (nr < 0.0 || nr > 99991231235959.0)
|
if (nr < 0.0 || nr > 99991231235959.0)
|
||||||
{
|
{
|
||||||
(void) Field_newdate::store((longlong) -1);
|
(void) Field_newdate::store((longlong) -1);
|
||||||
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3517,7 +3524,7 @@ int Field_newdate::store(longlong nr)
|
|||||||
if (nr < 0L || nr > 99991231L)
|
if (nr < 0L || nr > 99991231L)
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3535,7 +3542,7 @@ int Field_newdate::store(longlong nr)
|
|||||||
if (month > 12 || day > 31)
|
if (month > 12 || day > 31)
|
||||||
{
|
{
|
||||||
tmp=0L; // Don't allow date to change
|
tmp=0L; // Don't allow date to change
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3553,7 +3560,7 @@ void Field_newdate::store_time(TIME *ltime,timestamp_type type)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
int3store(ptr,tmp);
|
int3store(ptr,tmp);
|
||||||
}
|
}
|
||||||
@ -3671,7 +3678,7 @@ int Field_datetime::store(double nr)
|
|||||||
if (nr < 0.0 || nr > 99991231235959.0)
|
if (nr < 0.0 || nr > 99991231235959.0)
|
||||||
{
|
{
|
||||||
nr=0.0;
|
nr=0.0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
error |= Field_datetime::store((longlong) rint(nr));
|
error |= Field_datetime::store((longlong) rint(nr));
|
||||||
@ -3685,7 +3692,7 @@ int Field_datetime::store(longlong nr)
|
|||||||
if (nr < 0 || nr > LL(99991231235959))
|
if (nr < 0 || nr > LL(99991231235959))
|
||||||
{
|
{
|
||||||
nr=0;
|
nr=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3698,6 +3705,8 @@ int Field_datetime::store(longlong nr)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
longlongstore(ptr,nr);
|
longlongstore(ptr,nr);
|
||||||
|
if (current_thd->last_cuted_field)
|
||||||
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3710,7 +3719,7 @@ void Field_datetime::store_time(TIME *ltime,timestamp_type type)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
if (table->db_low_byte_first)
|
if (table->db_low_byte_first)
|
||||||
@ -3913,7 +3922,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||||||
from+= field_charset->scan(field_charset, from, end, MY_SEQ_SPACES);
|
from+= field_charset->scan(field_charset, from, end, MY_SEQ_SPACES);
|
||||||
if (from != end)
|
if (from != end)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error=1;
|
error=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4082,7 +4091,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||||||
if (length > field_length)
|
if (length > field_length)
|
||||||
{
|
{
|
||||||
length=field_length;
|
length=field_length;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error= 1;
|
error= 1;
|
||||||
}
|
}
|
||||||
memcpy(ptr+2,from,length);
|
memcpy(ptr+2,from,length);
|
||||||
@ -4305,7 +4314,7 @@ void Field_blob::store_length(uint32 number)
|
|||||||
if (number > 255)
|
if (number > 255)
|
||||||
{
|
{
|
||||||
number=255;
|
number=255;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
ptr[0]= (uchar) number;
|
ptr[0]= (uchar) number;
|
||||||
break;
|
break;
|
||||||
@ -4313,7 +4322,7 @@ void Field_blob::store_length(uint32 number)
|
|||||||
if (number > (uint16) ~0)
|
if (number > (uint16) ~0)
|
||||||
{
|
{
|
||||||
number= (uint16) ~0;
|
number= (uint16) ~0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
if (table->db_low_byte_first)
|
if (table->db_low_byte_first)
|
||||||
@ -4328,7 +4337,7 @@ void Field_blob::store_length(uint32 number)
|
|||||||
if (number > (uint32) (1L << 24))
|
if (number > (uint32) (1L << 24))
|
||||||
{
|
{
|
||||||
number= (uint32) (1L << 24)-1L;
|
number= (uint32) (1L << 24)-1L;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
int3store(ptr,number);
|
int3store(ptr,number);
|
||||||
break;
|
break;
|
||||||
@ -4939,11 +4948,11 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||||||
if (err || end != from+length || tmp > typelib->count)
|
if (err || end != from+length || tmp > typelib->count)
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp=0;
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
store_type((ulonglong) tmp);
|
store_type((ulonglong) tmp);
|
||||||
return err;
|
return err;
|
||||||
@ -4961,7 +4970,7 @@ int Field_enum::store(longlong nr)
|
|||||||
int error= 0;
|
int error= 0;
|
||||||
if ((uint) nr > typelib->count || nr == 0)
|
if ((uint) nr > typelib->count || nr == 0)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
nr=0;
|
nr=0;
|
||||||
error=1;
|
error=1;
|
||||||
}
|
}
|
||||||
@ -5089,7 +5098,7 @@ void Field_enum::sql_type(String &res) const
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ulonglong find_set(TYPELIB *lib, const char *x, uint length, char **err_pos,
|
ulonglong find_set(TYPELIB *lib, const char *x, uint length, char **err_pos,
|
||||||
uint *err_len)
|
uint *err_len, bool *set_warning)
|
||||||
{
|
{
|
||||||
const char *end= x + length;
|
const char *end= x + length;
|
||||||
*err_pos= 0; // No error yet
|
*err_pos= 0; // No error yet
|
||||||
@ -5101,7 +5110,6 @@ ulonglong find_set(TYPELIB *lib, const char *x, uint length, char **err_pos,
|
|||||||
if (x != end)
|
if (x != end)
|
||||||
{
|
{
|
||||||
const char *start= x;
|
const char *start= x;
|
||||||
bool error= 0;
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const char *pos= start;
|
const char *pos= start;
|
||||||
@ -5114,7 +5122,7 @@ ulonglong find_set(TYPELIB *lib, const char *x, uint length, char **err_pos,
|
|||||||
{
|
{
|
||||||
*err_pos= (char*) start;
|
*err_pos= (char*) start;
|
||||||
*err_len= var_len;
|
*err_len= var_len;
|
||||||
error= 1;
|
*set_warning= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
found|= ((longlong) 1 << (find - 1));
|
found|= ((longlong) 1 << (find - 1));
|
||||||
@ -5122,8 +5130,6 @@ ulonglong find_set(TYPELIB *lib, const char *x, uint length, char **err_pos,
|
|||||||
break;
|
break;
|
||||||
start= pos + 1;
|
start= pos + 1;
|
||||||
}
|
}
|
||||||
if (error)
|
|
||||||
current_thd->cuted_fields++;
|
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
@ -5131,6 +5137,7 @@ ulonglong find_set(TYPELIB *lib, const char *x, uint length, char **err_pos,
|
|||||||
|
|
||||||
int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
|
int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
|
bool set_warning= 0;
|
||||||
int err= 0;
|
int err= 0;
|
||||||
char *not_used;
|
char *not_used;
|
||||||
uint not_used2;
|
uint not_used2;
|
||||||
@ -5143,7 +5150,7 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||||||
from= tmpstr.ptr();
|
from= tmpstr.ptr();
|
||||||
length= tmpstr.length();
|
length= tmpstr.length();
|
||||||
}
|
}
|
||||||
ulonglong tmp= find_set(typelib, from, length, ¬_used, ¬_used2);
|
ulonglong tmp= find_set(typelib, from, length, ¬_used, ¬_used2, &set_warning);
|
||||||
if (!tmp && length && length < 22)
|
if (!tmp && length && length < 22)
|
||||||
{
|
{
|
||||||
/* This is for reading numbers with LOAD DATA INFILE */
|
/* This is for reading numbers with LOAD DATA INFILE */
|
||||||
@ -5153,9 +5160,11 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||||||
tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
|
tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
|
||||||
{
|
{
|
||||||
tmp=0;
|
tmp=0;
|
||||||
|
current_thd->cuted_fields++;
|
||||||
|
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
ER_WARN_DATA_TRUNCATED, ER(ER_WARN_DATA_TRUNCATED),
|
||||||
|
field_name, 0);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
current_thd->cuted_fields--; // Remove warning from find_set
|
|
||||||
}
|
}
|
||||||
store_type(tmp);
|
store_type(tmp);
|
||||||
return err;
|
return err;
|
||||||
@ -5169,7 +5178,7 @@ int Field_set::store(longlong nr)
|
|||||||
(longlong) 1))
|
(longlong) 1))
|
||||||
{
|
{
|
||||||
nr&= (longlong) (((longlong) 1 << typelib->count) - (longlong) 1);
|
nr&= (longlong) (((longlong) 1 << typelib->count) - (longlong) 1);
|
||||||
current_thd->cuted_fields++;
|
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
|
||||||
error=1;
|
error=1;
|
||||||
}
|
}
|
||||||
store_type((ulonglong) nr);
|
store_type((ulonglong) nr);
|
||||||
@ -5485,3 +5494,13 @@ create_field::create_field(Field *old_field,Field *orig_field)
|
|||||||
geom_type= ((Field_geom*)old_field)->geom_type;
|
geom_type= ((Field_geom*)old_field)->geom_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Warning handling */
|
||||||
|
void Field::set_warning(const uint level, const uint code)
|
||||||
|
{
|
||||||
|
THD *thd= current_thd;
|
||||||
|
thd->cuted_fields++;
|
||||||
|
push_warning_printf(thd, (MYSQL_ERROR::enum_warning_level)level,
|
||||||
|
code, ER(code), field_name, thd->row_count);
|
||||||
|
}
|
||||||
|
@ -210,6 +210,8 @@ public:
|
|||||||
virtual bool get_time(TIME *ltime);
|
virtual bool get_time(TIME *ltime);
|
||||||
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
|
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
|
||||||
virtual void set_charset(CHARSET_INFO *charset) { }
|
virtual void set_charset(CHARSET_INFO *charset) { }
|
||||||
|
virtual void set_warning(const unsigned int level,
|
||||||
|
const unsigned int code);
|
||||||
friend bool reopen_table(THD *,struct st_table *,bool);
|
friend bool reopen_table(THD *,struct st_table *,bool);
|
||||||
friend int cre_myisam(my_string name, register TABLE *form, uint options,
|
friend int cre_myisam(my_string name, register TABLE *form, uint options,
|
||||||
ulonglong auto_increment_value);
|
ulonglong auto_increment_value);
|
||||||
@ -1108,7 +1110,7 @@ bool set_field_to_null(Field *field);
|
|||||||
bool set_field_to_null_with_conversions(Field *field, bool no_conversions);
|
bool set_field_to_null_with_conversions(Field *field, bool no_conversions);
|
||||||
uint find_enum(TYPELIB *typelib,const char *x, uint length);
|
uint find_enum(TYPELIB *typelib,const char *x, uint length);
|
||||||
ulonglong find_set(TYPELIB *typelib,const char *x, uint length,
|
ulonglong find_set(TYPELIB *typelib,const char *x, uint length,
|
||||||
char **err_pos, uint *err_len);
|
char **err_pos, uint *err_len, bool *set_warning);
|
||||||
bool test_if_int(const char *str, int length, const char *int_end,
|
bool test_if_int(const char *str, int length, const char *int_end,
|
||||||
CHARSET_INFO *cs);
|
CHARSET_INFO *cs);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ set_field_to_null(Field *field)
|
|||||||
field->reset();
|
field->reset();
|
||||||
if (current_thd->count_cuted_fields)
|
if (current_thd->count_cuted_fields)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++; // Increment error counter
|
field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,ER_WARN_DATA_TRUNCATED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!current_thd->no_errors)
|
if (!current_thd->no_errors)
|
||||||
@ -175,7 +175,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
|
|||||||
return 0; // field is set in handler.cc
|
return 0; // field is set in handler.cc
|
||||||
if (current_thd->count_cuted_fields)
|
if (current_thd->count_cuted_fields)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++; // Increment error counter
|
field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,ER_WARN_NULL_TO_NOTNULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!current_thd->no_errors)
|
if (!current_thd->no_errors)
|
||||||
@ -225,7 +225,8 @@ static void do_copy_not_null(Copy_field *copy)
|
|||||||
{
|
{
|
||||||
if (*copy->from_null_ptr & copy->from_bit)
|
if (*copy->from_null_ptr & copy->from_bit)
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++;
|
copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
ER_WARN_DATA_TRUNCATED);
|
||||||
copy->to_field->reset();
|
copy->to_field->reset();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -324,7 +325,8 @@ static void do_cut_string(Copy_field *copy)
|
|||||||
{
|
{
|
||||||
if (!my_isspace(system_charset_info, *ptr)) // QQ: ucs incompatible
|
if (!my_isspace(system_charset_info, *ptr)) // QQ: ucs incompatible
|
||||||
{
|
{
|
||||||
current_thd->cuted_fields++; // Give a warning
|
copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
ER_WARN_DATA_TRUNCATED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,7 +346,8 @@ static void do_varstring(Copy_field *copy)
|
|||||||
{
|
{
|
||||||
length=copy->to_length-2;
|
length=copy->to_length-2;
|
||||||
if (current_thd->count_cuted_fields)
|
if (current_thd->count_cuted_fields)
|
||||||
current_thd->cuted_fields++; // Increment error counter
|
copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
ER_WARN_DATA_TRUNCATED);
|
||||||
}
|
}
|
||||||
int2store(copy->to_ptr,length);
|
int2store(copy->to_ptr,length);
|
||||||
memcpy(copy->to_ptr+2, copy->from_ptr,length);
|
memcpy(copy->to_ptr+2, copy->from_ptr,length);
|
||||||
|
@ -1010,6 +1010,7 @@ err:
|
|||||||
|
|
||||||
bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
|
bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
|
||||||
{
|
{
|
||||||
|
bool not_used;
|
||||||
char buff[80], *error= 0;
|
char buff[80], *error= 0;
|
||||||
uint error_len= 0;
|
uint error_len= 0;
|
||||||
String str(buff, sizeof(buff), system_charset_info), *res;
|
String str(buff, sizeof(buff), system_charset_info), *res;
|
||||||
@ -1019,7 +1020,7 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
|
|||||||
if (!(res= var->value->val_str(&str)))
|
if (!(res= var->value->val_str(&str)))
|
||||||
goto err;
|
goto err;
|
||||||
var->save_result.ulong_value= (ulong)
|
var->save_result.ulong_value= (ulong)
|
||||||
find_set(enum_names, res->c_ptr(), res->length(), &error, &error_len);
|
find_set(enum_names, res->c_ptr(), res->length(), &error, &error_len, ¬_used);
|
||||||
if (error_len)
|
if (error_len)
|
||||||
{
|
{
|
||||||
strmake(buff, error, min(sizeof(buff), error_len));
|
strmake(buff, error, min(sizeof(buff), error_len));
|
||||||
|
@ -260,8 +260,10 @@
|
|||||||
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
|
"Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)"
|
||||||
"Z_DATA_ERROR: Input data was corrupted for zlib"
|
"Z_DATA_ERROR: Input data was corrupted for zlib"
|
||||||
"%d line(s) was(were) cut by group_concat()";
|
"%d line(s) was(were) cut by group_concat()";
|
||||||
"Value count is fewer than the column count at row %ld";
|
"Record count is fewer than the column count at row %ld";
|
||||||
"Value count is more than the column count at row %ld";
|
"Record count is more than the column count at row %ld";
|
||||||
"Data truncated for column '%s' at row %ld";
|
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
|
||||||
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"
|
"Data truncated, out of range for column '%s' at row %ld";
|
||||||
|
"Data truncated for column '%s' at row %ld"
|
||||||
|
|
||||||
|
|
||||||
|
@ -512,6 +512,7 @@ public:
|
|||||||
ulong query_id, warn_id, version, options, thread_id, col_access;
|
ulong query_id, warn_id, version, options, thread_id, col_access;
|
||||||
ulong current_stmt_id;
|
ulong current_stmt_id;
|
||||||
ulong rand_saved_seed1, rand_saved_seed2;
|
ulong rand_saved_seed1, rand_saved_seed2;
|
||||||
|
ulong row_count; // Row counter, mainly for errors and warnings
|
||||||
long dbug_thread_id;
|
long dbug_thread_id;
|
||||||
pthread_t real_id;
|
pthread_t real_id;
|
||||||
uint current_tablenr,tmp_table,cond_count;
|
uint current_tablenr,tmp_table,cond_count;
|
||||||
@ -530,6 +531,7 @@ public:
|
|||||||
uint8 query_cache_type; // type of query cache processing
|
uint8 query_cache_type; // type of query cache processing
|
||||||
bool slave_thread;
|
bool slave_thread;
|
||||||
bool set_query_id,locked,count_cuted_fields,some_tables_deleted;
|
bool set_query_id,locked,count_cuted_fields,some_tables_deleted;
|
||||||
|
bool last_cuted_field;
|
||||||
bool no_errors, allow_sum_func, password, is_fatal_error;
|
bool no_errors, allow_sum_func, password, is_fatal_error;
|
||||||
bool query_start_used,last_insert_id_used,insert_id_used,rand_used;
|
bool query_start_used,last_insert_id_used,insert_id_used,rand_used;
|
||||||
bool system_thread,in_lock_tables,global_read_lock;
|
bool system_thread,in_lock_tables,global_read_lock;
|
||||||
|
@ -79,6 +79,7 @@ void mysql_reset_errors(THD *thd)
|
|||||||
free_root(&thd->warn_root,MYF(0));
|
free_root(&thd->warn_root,MYF(0));
|
||||||
bzero((char*) thd->warn_count, sizeof(thd->warn_count));
|
bzero((char*) thd->warn_count, sizeof(thd->warn_count));
|
||||||
thd->warn_list.empty();
|
thd->warn_list.empty();
|
||||||
|
thd->row_count= 1; // by default point to row 1
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
@ -297,6 +297,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
{ // Get auto increment value
|
{ // Get auto increment value
|
||||||
id= thd->last_insert_id;
|
id= thd->last_insert_id;
|
||||||
}
|
}
|
||||||
|
thd->row_count++;
|
||||||
}
|
}
|
||||||
if (lock_type == TL_WRITE_DELAYED)
|
if (lock_type == TL_WRITE_DELAYED)
|
||||||
{
|
{
|
||||||
|
@ -368,11 +368,10 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
|
|||||||
List_iterator_fast<Item> it(fields);
|
List_iterator_fast<Item> it(fields);
|
||||||
Item_field *sql_field;
|
Item_field *sql_field;
|
||||||
ulonglong id;
|
ulonglong id;
|
||||||
ulong row_pos;
|
|
||||||
DBUG_ENTER("read_fixed_length");
|
DBUG_ENTER("read_fixed_length");
|
||||||
|
|
||||||
id= 0;
|
id= 0;
|
||||||
row_pos= 1;
|
|
||||||
/* No fields can be null in this format. mark all fields as not null */
|
/* No fields can be null in this format. mark all fields as not null */
|
||||||
while ((sql_field= (Item_field*) it++))
|
while ((sql_field= (Item_field*) it++))
|
||||||
sql_field->field->set_notnull();
|
sql_field->field->set_notnull();
|
||||||
@ -391,14 +390,14 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
|
|||||||
#endif
|
#endif
|
||||||
while ((sql_field= (Item_field*) it++))
|
while ((sql_field= (Item_field*) it++))
|
||||||
{
|
{
|
||||||
Field *field=sql_field->field;
|
Field *field= sql_field->field;
|
||||||
if (pos == read_info.row_end)
|
if (pos == read_info.row_end)
|
||||||
{
|
{
|
||||||
thd->cuted_fields++; /* Not enough fields */
|
thd->cuted_fields++; /* Not enough fields */
|
||||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_TOO_FEW_RECORDS,
|
ER_WARN_TOO_FEW_RECORDS,
|
||||||
ER(ER_WARN_TOO_FEW_RECORDS), row_pos);
|
ER(ER_WARN_TOO_FEW_RECORDS), thd->row_count);
|
||||||
field->reset();
|
field->reset();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -408,13 +407,7 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
|
|||||||
field->field_length)
|
field->field_length)
|
||||||
length=field->field_length;
|
length=field->field_length;
|
||||||
save_chr=pos[length]; pos[length]='\0'; // Safeguard aganst malloc
|
save_chr=pos[length]; pos[length]='\0'; // Safeguard aganst malloc
|
||||||
if (field->store((char*) pos,length,read_info.read_charset))
|
field->store((char*) pos,length,read_info.read_charset);
|
||||||
{
|
|
||||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
ER_WARN_DATA_TRUNCATED,
|
|
||||||
ER(ER_WARN_DATA_TRUNCATED),
|
|
||||||
field->field_name, row_pos);
|
|
||||||
}
|
|
||||||
pos[length]=save_chr;
|
pos[length]=save_chr;
|
||||||
if ((pos+=length) > read_info.row_end)
|
if ((pos+=length) > read_info.row_end)
|
||||||
pos= read_info.row_end; /* Fills rest with space */
|
pos= read_info.row_end; /* Fills rest with space */
|
||||||
@ -425,7 +418,7 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
|
|||||||
thd->cuted_fields++; /* To long row */
|
thd->cuted_fields++; /* To long row */
|
||||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_TOO_MANY_RECORDS,
|
ER_WARN_TOO_MANY_RECORDS,
|
||||||
ER(ER_WARN_TOO_MANY_RECORDS), row_pos);
|
ER(ER_WARN_TOO_MANY_RECORDS), thd->row_count);
|
||||||
}
|
}
|
||||||
if (write_record(table,&info))
|
if (write_record(table,&info))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@ -446,9 +439,9 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
|
|||||||
thd->cuted_fields++; /* To long row */
|
thd->cuted_fields++; /* To long row */
|
||||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_TOO_MANY_RECORDS,
|
ER_WARN_TOO_MANY_RECORDS,
|
||||||
ER(ER_WARN_TOO_MANY_RECORDS), row_pos);
|
ER(ER_WARN_TOO_MANY_RECORDS), thd->row_count);
|
||||||
}
|
}
|
||||||
row_pos++;
|
thd->row_count++;
|
||||||
}
|
}
|
||||||
if (id && !read_info.error)
|
if (id && !read_info.error)
|
||||||
thd->insert_id(id); // For binary/update log
|
thd->insert_id(id); // For binary/update log
|
||||||
@ -466,12 +459,10 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
|
|||||||
Item_field *sql_field;
|
Item_field *sql_field;
|
||||||
uint enclosed_length;
|
uint enclosed_length;
|
||||||
ulonglong id;
|
ulonglong id;
|
||||||
ulong row_pos;
|
|
||||||
DBUG_ENTER("read_sep_field");
|
DBUG_ENTER("read_sep_field");
|
||||||
|
|
||||||
enclosed_length=enclosed.length();
|
enclosed_length=enclosed.length();
|
||||||
id= 0;
|
id= 0;
|
||||||
row_pos= 1;
|
|
||||||
|
|
||||||
for (;;it.rewind())
|
for (;;it.rewind())
|
||||||
{
|
{
|
||||||
@ -502,26 +493,14 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
|
|||||||
if (field->type() == FIELD_TYPE_TIMESTAMP)
|
if (field->type() == FIELD_TYPE_TIMESTAMP)
|
||||||
((Field_timestamp*) field)->set_time();
|
((Field_timestamp*) field)->set_time();
|
||||||
else if (field != table->next_number_field)
|
else if (field != table->next_number_field)
|
||||||
{
|
field->set_warning((uint)MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
thd->cuted_fields++;
|
ER_WARN_NULL_TO_NOTNULL);
|
||||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
ER_WARN_NULL_TO_NOTNULL,
|
|
||||||
ER(ER_WARN_NULL_TO_NOTNULL),
|
|
||||||
field->field_name, row_pos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
field->set_notnull();
|
field->set_notnull();
|
||||||
read_info.row_end[0]=0; // Safe to change end marker
|
read_info.row_end[0]=0; // Safe to change end marker
|
||||||
if (field->store((char*) read_info.row_start,length,read_info.read_charset))
|
field->store((char*) read_info.row_start,length,read_info.read_charset);
|
||||||
{
|
|
||||||
// Data truncated or out of bounds
|
|
||||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
|
||||||
ER_WARN_DATA_TRUNCATED,
|
|
||||||
ER(ER_WARN_DATA_TRUNCATED),
|
|
||||||
field->field_name, row_pos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (read_info.error)
|
if (read_info.error)
|
||||||
break;
|
break;
|
||||||
@ -536,7 +515,7 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
|
|||||||
thd->cuted_fields++;
|
thd->cuted_fields++;
|
||||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_TOO_FEW_RECORDS,
|
ER_WARN_TOO_FEW_RECORDS,
|
||||||
ER(ER_WARN_TOO_FEW_RECORDS), row_pos);
|
ER(ER_WARN_TOO_FEW_RECORDS), thd->row_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (write_record(table,&info))
|
if (write_record(table,&info))
|
||||||
@ -557,10 +536,10 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
|
|||||||
{
|
{
|
||||||
thd->cuted_fields++; /* To long row */
|
thd->cuted_fields++; /* To long row */
|
||||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_TOO_MANY_RECORDS,
|
ER_WARN_TOO_MANY_RECORDS, ER(ER_WARN_TOO_MANY_RECORDS),
|
||||||
ER(ER_WARN_TOO_MANY_RECORDS), row_pos);
|
thd->row_count);
|
||||||
}
|
}
|
||||||
row_pos++;
|
thd->row_count++;
|
||||||
}
|
}
|
||||||
if (id && !read_info.error)
|
if (id && !read_info.error)
|
||||||
thd->insert_id(id); // For binary/update log
|
thd->insert_id(id); // For binary/update log
|
||||||
|
@ -3653,12 +3653,13 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
|||||||
{
|
{
|
||||||
char *not_used;
|
char *not_used;
|
||||||
uint not_used2;
|
uint not_used2;
|
||||||
|
bool not_used3;
|
||||||
|
|
||||||
thd->cuted_fields=0;
|
thd->cuted_fields=0;
|
||||||
String str,*res;
|
String str,*res;
|
||||||
res=default_value->val_str(&str);
|
res=default_value->val_str(&str);
|
||||||
(void) find_set(interval, res->ptr(), res->length(), ¬_used,
|
(void) find_set(interval, res->ptr(), res->length(), ¬_used,
|
||||||
¬_used2);
|
¬_used2, ¬_used3);
|
||||||
if (thd->cuted_fields)
|
if (thd->cuted_fields)
|
||||||
{
|
{
|
||||||
net_printf(thd,ER_INVALID_DEFAULT,field_name);
|
net_printf(thd,ER_INVALID_DEFAULT,field_name);
|
||||||
|
@ -5018,6 +5018,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
|
|||||||
ha_rows found_records=join->found_records;
|
ha_rows found_records=join->found_records;
|
||||||
READ_RECORD *info= &join_tab->read_record;
|
READ_RECORD *info= &join_tab->read_record;
|
||||||
|
|
||||||
|
join->thd->row_count= 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (join->thd->killed) // Aborted by user
|
if (join->thd->killed) // Aborted by user
|
||||||
@ -5026,6 +5027,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
|
|||||||
return -2; /* purecov: inspected */
|
return -2; /* purecov: inspected */
|
||||||
}
|
}
|
||||||
join->examined_rows++;
|
join->examined_rows++;
|
||||||
|
join->thd->row_count++;
|
||||||
if (!on_expr || on_expr->val_int())
|
if (!on_expr || on_expr->val_int())
|
||||||
{
|
{
|
||||||
found=1;
|
found=1;
|
||||||
|
@ -2383,6 +2383,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
|||||||
handle_duplicates == DUP_REPLACE)
|
handle_duplicates == DUP_REPLACE)
|
||||||
to->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
|
to->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
|
||||||
next_field=to->next_number_field;
|
next_field=to->next_number_field;
|
||||||
|
thd->row_count= 0;
|
||||||
while (!(error=info.read_record(&info)))
|
while (!(error=info.read_record(&info)))
|
||||||
{
|
{
|
||||||
if (thd->killed)
|
if (thd->killed)
|
||||||
@ -2391,6 +2392,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
|||||||
error= 1;
|
error= 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
thd->row_count++;
|
||||||
if (next_field)
|
if (next_field)
|
||||||
next_field->reset();
|
next_field->reset();
|
||||||
for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++)
|
for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++)
|
||||||
|
@ -315,6 +315,7 @@ int mysql_update(THD *thd,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
table->file->unlock_row();
|
table->file->unlock_row();
|
||||||
|
thd->row_count++;
|
||||||
}
|
}
|
||||||
end_read_record(&info);
|
end_read_record(&info);
|
||||||
thd->proc_info="end";
|
thd->proc_info="end";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user