Commit 4cc9707e authored by unknown's avatar unknown

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

into  mysql.com:/usr/home/ram/work/5.0.b11546

parents a41f7d72 607852cf
...@@ -1258,3 +1258,10 @@ select * from t1; ...@@ -1258,3 +1258,10 @@ select * from t1;
d d
2000-10-01 2000-10-01
drop table t1; drop table t1;
set @@sql_mode='traditional';
create table t1(a bit(2));
insert into t1 values(b'101');
ERROR 22001: Data too long for column 'a' at row 1
select * from t1;
a
drop table t1;
...@@ -1118,3 +1118,14 @@ insert into t1 values ('2000-10-01'); ...@@ -1118,3 +1118,14 @@ insert into t1 values ('2000-10-01');
update t1 set d = 1100; update t1 set d = 1100;
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# BIT fields
#
set @@sql_mode='traditional';
create table t1(a bit(2));
--error 1406
insert into t1 values(b'101');
select * from t1;
drop table t1;
...@@ -7846,7 +7846,10 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs) ...@@ -7846,7 +7846,10 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
{ {
set_rec_bits(0xff, bit_ptr, bit_ofs, bit_len); set_rec_bits(0xff, bit_ptr, bit_ofs, bit_len);
memset(ptr, 0xff, field_length); memset(ptr, 0xff, field_length);
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); if (table->in_use->really_abort_on_warning())
set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
else
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1; return 1;
} }
/* delta is >= -1 here */ /* delta is >= -1 here */
...@@ -8063,7 +8066,10 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs) ...@@ -8063,7 +8066,10 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
memset(ptr, 0xff, field_length); memset(ptr, 0xff, field_length);
if (bits) if (bits)
*ptr&= ((1 << bits) - 1); /* set first byte */ *ptr&= ((1 << bits) - 1); /* set first byte */
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); if (table->in_use->really_abort_on_warning())
set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
else
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1; return 1;
} }
bzero(ptr, delta); bzero(ptr, delta);
......
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