Loading mysql-test/r/federated.result +16 −16 Original line number Diff line number Diff line Loading @@ -1603,6 +1603,22 @@ fld_cid fld_name fld_parentid fld_delt 5 Torkel 0 0 DROP TABLE federated.t1; DROP TABLE federated.bug_17377_table; create table t1 (id int not null auto_increment primary key, val int); create table t1 (id int not null auto_increment primary key, val int) engine=federated connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; insert into t1 values (1,0),(2,0); update t1 set val = NULL where id = 1; select * from t1; id val 1 NULL 2 0 select * from t1; id val 1 NULL 2 0 drop table t1; drop table t1; drop table if exists federated.t1; create table federated.t1 (a int, b int, c int); drop table if exists federated.t1; Loading Loading @@ -1717,22 +1733,6 @@ id c1 c2 9 abc ppc drop table federated.t1, federated.t2; drop table federated.t1, federated.t2; create table t1 (id int not null auto_increment primary key, val int); create table t1 (id int not null auto_increment primary key, val int) engine=federated connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; insert into t1 values (1,0),(2,0); update t1 set val = NULL where id = 1; select * from t1; id val 1 NULL 2 0 select * from t1; id val 1 NULL 2 0 drop table t1; drop table t1; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; DROP TABLE IF EXISTS federated.t1; Loading mysql-test/t/federated.test +1 −0 Original line number Diff line number Diff line Loading @@ -1396,6 +1396,7 @@ drop table t1; # for ON INSERT triggers only. Tests for other types of triggers reside # in ndb_trigger.test. # connection slave; --disable_warnings drop table if exists federated.t1; --enable_warnings Loading sql/ha_federated.cc +10 −11 Original line number Diff line number Diff line Loading @@ -1775,7 +1775,7 @@ int ha_federated::repair(THD* thd, HA_CHECK_OPT* check_opt) it. Keep in mind that the server can do updates based on ordering if an ORDER BY clause was used. Consecutive ordering is not guarenteed. clause was used. Consecutive ordering is not guaranteed. Currently new_data will not have an updated auto_increament record, or and updated timestamp field. You can do these for federated by doing these: if (table->timestamp_on_update_now) Loading Loading @@ -1847,6 +1847,9 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) { if (bitmap_is_set(table->write_set, (*field)->field_index)) { update_string.append((*field)->field_name); update_string.append(FEDERATED_EQ); if ((*field)->is_null()) update_string.append(FEDERATED_NULL); else Loading @@ -1859,11 +1862,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) field_value.length(0); tmp_restore_column_map(table->read_set, old_map); } update_string.append((*field)->field_name); update_string.append(FEDERATED_EQ); update_string.append(new_field_value); update_string.append(FEDERATED_COMMA); new_field_value.length(0); } if (bitmap_is_set(table->read_set, (*field)->field_index)) Loading @@ -1874,11 +1873,11 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) else { where_string.append(FEDERATED_EQ); (*field)->val_str(&old_field_value, (*field)->val_str(&field_value, (char*) (old_data + (*field)->offset())); (*field)->quote_data(&old_field_value); where_string.append(old_field_value); old_field_value.length(0); (*field)->quote_data(&field_value); where_string.append(field_value); field_value.length(0); } where_string.append(FEDERATED_AND); } Loading Loading
mysql-test/r/federated.result +16 −16 Original line number Diff line number Diff line Loading @@ -1603,6 +1603,22 @@ fld_cid fld_name fld_parentid fld_delt 5 Torkel 0 0 DROP TABLE federated.t1; DROP TABLE federated.bug_17377_table; create table t1 (id int not null auto_increment primary key, val int); create table t1 (id int not null auto_increment primary key, val int) engine=federated connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; insert into t1 values (1,0),(2,0); update t1 set val = NULL where id = 1; select * from t1; id val 1 NULL 2 0 select * from t1; id val 1 NULL 2 0 drop table t1; drop table t1; drop table if exists federated.t1; create table federated.t1 (a int, b int, c int); drop table if exists federated.t1; Loading Loading @@ -1717,22 +1733,6 @@ id c1 c2 9 abc ppc drop table federated.t1, federated.t2; drop table federated.t1, federated.t2; create table t1 (id int not null auto_increment primary key, val int); create table t1 (id int not null auto_increment primary key, val int) engine=federated connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; insert into t1 values (1,0),(2,0); update t1 set val = NULL where id = 1; select * from t1; id val 1 NULL 2 0 select * from t1; id val 1 NULL 2 0 drop table t1; drop table t1; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; DROP TABLE IF EXISTS federated.t1; Loading
mysql-test/t/federated.test +1 −0 Original line number Diff line number Diff line Loading @@ -1396,6 +1396,7 @@ drop table t1; # for ON INSERT triggers only. Tests for other types of triggers reside # in ndb_trigger.test. # connection slave; --disable_warnings drop table if exists federated.t1; --enable_warnings Loading
sql/ha_federated.cc +10 −11 Original line number Diff line number Diff line Loading @@ -1775,7 +1775,7 @@ int ha_federated::repair(THD* thd, HA_CHECK_OPT* check_opt) it. Keep in mind that the server can do updates based on ordering if an ORDER BY clause was used. Consecutive ordering is not guarenteed. clause was used. Consecutive ordering is not guaranteed. Currently new_data will not have an updated auto_increament record, or and updated timestamp field. You can do these for federated by doing these: if (table->timestamp_on_update_now) Loading Loading @@ -1847,6 +1847,9 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) { if (bitmap_is_set(table->write_set, (*field)->field_index)) { update_string.append((*field)->field_name); update_string.append(FEDERATED_EQ); if ((*field)->is_null()) update_string.append(FEDERATED_NULL); else Loading @@ -1859,11 +1862,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) field_value.length(0); tmp_restore_column_map(table->read_set, old_map); } update_string.append((*field)->field_name); update_string.append(FEDERATED_EQ); update_string.append(new_field_value); update_string.append(FEDERATED_COMMA); new_field_value.length(0); } if (bitmap_is_set(table->read_set, (*field)->field_index)) Loading @@ -1874,11 +1873,11 @@ int ha_federated::update_row(const byte *old_data, byte *new_data) else { where_string.append(FEDERATED_EQ); (*field)->val_str(&old_field_value, (*field)->val_str(&field_value, (char*) (old_data + (*field)->offset())); (*field)->quote_data(&old_field_value); where_string.append(old_field_value); old_field_value.length(0); (*field)->quote_data(&field_value); where_string.append(field_value); field_value.length(0); } where_string.append(FEDERATED_AND); } Loading