Commit de02f176 authored by unknown's avatar unknown

Merge chilla.local:/home/mydev/mysql-5.1-amerge

into  chilla.local:/home/mydev/mysql-5.1-aid


sql/ha_federated.cc:
  Auto merged
parents 619d8b2c 8f107a26
...@@ -1558,6 +1558,8 @@ id ...@@ -1558,6 +1558,8 @@ id
3 3
4 4
5 5
DROP TABLE federated.t1;
DROP TABLE federated.t1;
DROP TABLE IF EXISTS federated.bug_17377_table; DROP TABLE IF EXISTS federated.bug_17377_table;
CREATE TABLE federated.bug_17377_table ( CREATE TABLE federated.bug_17377_table (
`fld_cid` bigint(20) NOT NULL auto_increment, `fld_cid` bigint(20) NOT NULL auto_increment,
...@@ -1601,7 +1603,92 @@ fld_cid fld_name fld_parentid fld_delt ...@@ -1601,7 +1603,92 @@ fld_cid fld_name fld_parentid fld_delt
5 Torkel 0 0 5 Torkel 0 0
DROP TABLE federated.t1; DROP TABLE federated.t1;
DROP TABLE federated.bug_17377_table; DROP TABLE federated.bug_17377_table;
DROP TABLE federated.t1; create table federated.t1 (i1 int, i2 int, i3 int);
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20));
create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t2';
insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
select * from federated.t1 order by i1;
i1 i2 i3
1 5 10
2 2 2
3 7 12
4 5 2
9 10 15
select * from federated.t2;
id c1 c2
9 abc def
5 opq lmn
2 test t t test
update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
select * from federated.t1 order by i1;
i1 i2 i3
1 5 10
2 15 2
3 7 12
4 5 2
9 15 15
select * from federated.t2 order by id;
id c1 c2
2 test t ppc
5 opq lmn
9 abc ppc
delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
select * from federated.t1 order by i1;
i1 i2 i3
2 15 2
3 7 12
9 15 15
select * from federated.t2 order by id;
id c1 c2
2 test t ppc
9 abc ppc
drop table federated.t1, federated.t2;
drop table federated.t1, federated.t2;
create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1));
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id));
create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t2';
insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
select * from federated.t1 order by i1;
i1 i2 i3
1 5 10
2 2 2
3 7 12
4 5 2
9 10 15
select * from federated.t2 order by id;
id c1 c2
2 test t t test
5 opq lmn
9 abc def
update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
select * from federated.t1 order by i1;
i1 i2 i3
1 5 10
2 15 2
3 7 12
4 5 2
9 15 15
select * from federated.t2 order by id;
id c1 c2
2 test t ppc
5 opq lmn
9 abc ppc
delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
select * from federated.t1 order by i1;
i1 i2 i3
2 15 2
3 7 12
9 15 15
select * from federated.t2 order by id;
id c1 c2
2 test t ppc
9 abc ppc
drop table federated.t1, federated.t2;
drop table federated.t1, federated.t2;
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;
......
...@@ -1256,6 +1256,10 @@ SELECT LAST_INSERT_ID(); ...@@ -1256,6 +1256,10 @@ SELECT LAST_INSERT_ID();
INSERT INTO federated.t1 VALUES (); INSERT INTO federated.t1 VALUES ();
SELECT LAST_INSERT_ID(); SELECT LAST_INSERT_ID();
SELECT * FROM federated.t1; SELECT * FROM federated.t1;
DROP TABLE federated.t1;
connection slave;
DROP TABLE federated.t1;
# #
# Bug#17377 Federated Engine returns wrong Data, always the rows # Bug#17377 Federated Engine returns wrong Data, always the rows
...@@ -1310,19 +1314,19 @@ select * from federated.t1 where fld_parentid=0 and fld_delt=0; ...@@ -1310,19 +1314,19 @@ select * from federated.t1 where fld_parentid=0 and fld_delt=0;
DROP TABLE federated.t1; DROP TABLE federated.t1;
connection slave; connection slave;
DROP TABLE federated.bug_17377_table; DROP TABLE federated.bug_17377_table;
DROP TABLE federated.t1;
# #
# Test multi updates and deletes without keys # BUG 19773 Crash when using multi-table updates, deletes
# with federated tables
# #
# The following can be enabled when bug #19773 has been fixed
--disable_parsing
connection slave; connection slave;
create table federated.t1 (i1 int, i2 int, i3 int); create table federated.t1 (i1 int, i2 int, i3 int);
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)); create table federated.t2 (id int, c1 varchar(20), c2 varchar(20));
connection master; connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'; eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
...@@ -1331,22 +1335,23 @@ select * from federated.t2; ...@@ -1331,22 +1335,23 @@ select * from federated.t2;
update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
select * from federated.t1 order by i1; select * from federated.t1 order by i1;
select * from federated.t2 order by id; select * from federated.t2 order by id;
delete t1.*,t2.* from federated.t1,federated.t2 where t1.i2=t2.id; delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
select * from federated.t1 order by i1; select * from federated.t1 order by i1;
select * from federated.t2 order by id; select * from federated.t2 order by id;
drop table federated.t1, federated.t2; drop table federated.t1, federated.t2;
connection slave; connection slave;
drop table federated.t1, federated.t2; drop table federated.t1, federated.t2;
connection master;
# Test multi updates and deletes with keys # Test multi updates and deletes with keys
connection slave; connection slave;
create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1)); create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1));
create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id)); create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id));
connection master; connection master;
eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; --replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'; eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
select * from federated.t1 order by i1; select * from federated.t1 order by i1;
...@@ -1354,13 +1359,12 @@ select * from federated.t2 order by id; ...@@ -1354,13 +1359,12 @@ select * from federated.t2 order by id;
update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
select * from federated.t1 order by i1; select * from federated.t1 order by i1;
select * from federated.t2 order by id; select * from federated.t2 order by id;
delete t1.*,t2.* from federated.t1,federated.t2 where t1.i2=t2.id; delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
select * from federated.t1 order by i1; select * from federated.t1 order by i1;
select * from federated.t2 order by id; select * from federated.t2 order by id;
drop table federated.t1, federated.t2; drop table federated.t1, federated.t2;
connection slave; connection slave;
drop table federated.t1, federated.t2; drop table federated.t1, federated.t2;
connection master;
--enable_parsing
--source include/federated_cleanup.inc source include/federated_cleanup.inc;
This diff is collapsed.
...@@ -130,6 +130,7 @@ typedef struct st_federated_share { ...@@ -130,6 +130,7 @@ typedef struct st_federated_share {
remote host info, parse_url supplies remote host info, parse_url supplies
*/ */
char *scheme; char *scheme;
char *connect_string;
char *hostname; char *hostname;
char *username; char *username;
char *password; char *password;
...@@ -139,7 +140,7 @@ typedef struct st_federated_share { ...@@ -139,7 +140,7 @@ typedef struct st_federated_share {
char *socket; char *socket;
char *sport; char *sport;
ushort port; ushort port;
uint table_name_length, use_count; uint table_name_length, connect_string_length, use_count;
pthread_mutex_t mutex; pthread_mutex_t mutex;
THR_LOCK lock; THR_LOCK lock;
} FEDERATED_SHARE; } FEDERATED_SHARE;
...@@ -153,7 +154,6 @@ class ha_federated: public handler ...@@ -153,7 +154,6 @@ class ha_federated: public handler
FEDERATED_SHARE *share; /* Shared lock info */ FEDERATED_SHARE *share; /* Shared lock info */
MYSQL *mysql; /* MySQL connection */ MYSQL *mysql; /* MySQL connection */
MYSQL_RES *stored_result; MYSQL_RES *stored_result;
uint ref_length;
uint fetch_num; // stores the fetch num uint fetch_num; // stores the fetch num
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;
...@@ -164,7 +164,8 @@ class ha_federated: public handler ...@@ -164,7 +164,8 @@ class ha_federated: public handler
return 0 on success return 0 on success
return errorcode otherwise return errorcode otherwise
*/ */
uint convert_row_to_internal_format(byte *buf, MYSQL_ROW row); uint convert_row_to_internal_format(byte *buf, MYSQL_ROW row,
MYSQL_RES *row);
bool create_where_from_key(String *to, KEY *key_info, bool create_where_from_key(String *to, KEY *key_info,
const key_range *start_key, const key_range *start_key,
const key_range *end_key, const key_range *end_key,
...@@ -304,6 +305,13 @@ class ha_federated: public handler ...@@ -304,6 +305,13 @@ class ha_federated: public handler
int connection_rollback(); int connection_rollback();
int connection_autocommit(bool state); int connection_autocommit(bool state);
int execute_simple_query(const char *query, int len); int execute_simple_query(const char *query, int len);
int read_next(byte *buf, MYSQL_RES *result);
int index_read_idx_with_result_set(byte *buf, uint index,
const byte *key,
uint key_len,
ha_rkey_function find_flag,
MYSQL_RES **result);
}; };
int federated_db_init(void); int federated_db_init(void);
......
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