Commit d1db6208 authored by unknown's avatar unknown

undo one row warning instead use sql_warnings=1


sql/sql_insert.cc:
  Undo warnings for single row inserts
mysql-test/t/warnings.test:
  undo one row warning instead use sql_warnings=1
mysql-test/r/warnings.result:
  Fix result file
parent f22517e4
...@@ -91,8 +91,11 @@ Warning 1263 Data truncated for column 'b' at row 3 ...@@ -91,8 +91,11 @@ Warning 1263 Data truncated for column 'b' at row 3
Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 4 Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 4
Warning 1263 Data truncated for column 'b' at row 4 Warning 1263 Data truncated for column 'b' at row 4
insert into t2(b) values('mysqlab'); insert into t2(b) values('mysqlab');
set sql_warnings=1;
insert into t2(b) values('mysqlab');
Warnings: Warnings:
Warning 1263 Data truncated for column 'b' at row 1 Warning 1263 Data truncated for column 'b' at row 1
set sql_warnings=0;
drop table t1, t2; drop table t1, t2;
create table t1(a char(10)); create table t1(a char(10));
alter table t1 add b char; alter table t1 add b char;
......
...@@ -52,6 +52,9 @@ update t1 set d=c; ...@@ -52,6 +52,9 @@ update t1 set d=c;
create table t2(a tinyint NOT NULL, b char(3)); create table t2(a tinyint NOT NULL, b char(3));
insert into t2 select b,c from t1; insert into t2 select b,c from t1;
insert into t2(b) values('mysqlab'); insert into t2(b) values('mysqlab');
set sql_warnings=1;
insert into t2(b) values('mysqlab');
set sql_warnings=0;
drop table t1, t2; drop table t1, t2;
# #
......
...@@ -231,9 +231,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, ...@@ -231,9 +231,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
info.update_fields=&update_fields; info.update_fields=&update_fields;
info.update_values=&update_values; info.update_values=&update_values;
// Don't count warnings for simple inserts // Don't count warnings for simple inserts
if ((thd->client_capabilities & CLIENT_PROTOCOL_41) || if (values_list.elements > 1 || (thd->options & OPTION_WARNINGS))
values_list.elements > 1 ||
(thd->options & OPTION_WARNINGS))
thd->count_cuted_fields = 1; thd->count_cuted_fields = 1;
thd->cuted_fields = 0L; thd->cuted_fields = 0L;
table->next_number_field=table->found_next_number_field; table->next_number_field=table->found_next_number_field;
......
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