Commit 0e5e884b authored by unknown's avatar unknown

Bug#29019

  "REPLACE/INSERT IGNORE/UPDATE IGNORE doesn't work"
  Federated does not record neccessary HA_EXTRA flags in order to
  support REPLACE/INSERT IGNORE/UPDATE IGNORE.
  Implement ::extra() to capture flags neccessary for functionality.
New function append_ident() to better escape identifiers consistantly.


mysql-test/r/federated.result:
  test for bug29019
mysql-test/t/federated.test:
  test for bug29019
sql/ha_federated.cc:
  Bug29019
    Federated does not record neccessary HA_EXTRA flags in order to
    support REPLACE/INSERT IGNORE/UPDATE IGNORE.
    Implement ::extra() to capture flags neccessary for functionality.
  New function append_ident() to better escape identifiers consistantly.
sql/ha_federated.h:
  bug29019
    add 2 member values to ha_federated class
      ignore_duplicates and replace_duplicates.
    add 1 member method to ha_federated class
      extra()
parent 637d9f1c
...@@ -1843,6 +1843,30 @@ C3A4C3B6C3BCC39F ...@@ -1843,6 +1843,30 @@ C3A4C3B6C3BCC39F
D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E
drop table federated.t1; drop table federated.t1;
drop table federated.t1; drop table federated.t1;
create table federated.t1 (a int primary key, b varchar(64))
DEFAULT CHARSET=utf8;
create table federated.t1 (a int primary key, b varchar(64))
ENGINE=FEDERATED
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'
DEFAULT CHARSET=utf8;
insert ignore into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
select * from federated.t1;
a b
1 Larry
2 Curly
truncate federated.t1;
replace into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
select * from federated.t1;
a b
1 Moe
2 Curly
update ignore federated.t1 set a=a+1;
select * from federated.t1;
a b
1 Moe
3 Curly
drop table federated.t1;
drop table federated.t1;
DROP TABLE IF EXISTS federated.t1; DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated; DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1; DROP TABLE IF EXISTS federated.t1;
......
...@@ -1576,4 +1576,31 @@ connection slave; ...@@ -1576,4 +1576,31 @@ connection slave;
drop table federated.t1; drop table federated.t1;
#
# BUG#21019 Federated Engine does not support REPLACE/INSERT IGNORE/UPDATE IGNORE
#
connection slave;
create table federated.t1 (a int primary key, b varchar(64))
DEFAULT CHARSET=utf8;
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.t1 (a int primary key, b varchar(64))
ENGINE=FEDERATED
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
DEFAULT CHARSET=utf8;
insert ignore into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
select * from federated.t1;
truncate federated.t1;
replace into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
select * from federated.t1;
update ignore federated.t1 set a=a+1;
select * from federated.t1;
drop table federated.t1;
connection slave;
drop table federated.t1;
source include/federated_cleanup.inc; source include/federated_cleanup.inc;
This diff is collapsed.
...@@ -157,6 +157,7 @@ class ha_federated: public handler ...@@ -157,6 +157,7 @@ class ha_federated: public handler
MYSQL_ROW_OFFSET current_position; // Current position used by ::position() MYSQL_ROW_OFFSET current_position; // Current position used by ::position()
int remote_error_number; int remote_error_number;
char remote_error_buf[FEDERATED_QUERY_BUFFER_SIZE]; char remote_error_buf[FEDERATED_QUERY_BUFFER_SIZE];
bool ignore_duplicates, replace_duplicates;
private: private:
/* /*
...@@ -284,6 +285,7 @@ class ha_federated: public handler ...@@ -284,6 +285,7 @@ class ha_federated: public handler
int rnd_pos(byte *buf, byte *pos); //required int rnd_pos(byte *buf, byte *pos); //required
void position(const byte *record); //required void position(const byte *record); //required
int info(uint); //required int info(uint); //required
int extra(ha_extra_function operation);
void update_auto_increment(void); void update_auto_increment(void);
int repair(THD* thd, HA_CHECK_OPT* check_opt); int repair(THD* thd, HA_CHECK_OPT* check_opt);
......
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