Commit 4a28a79e authored by Kentoku's avatar Kentoku Committed by Sachin

Update Spider to version 3.3.14. Add direct left outer join/right outer join/inner join feature

parent 74eb4fc9
This diff is collapsed.
/* Copyright (C) 2008-2017 Kentoku Shiba
/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -576,6 +576,7 @@ class ha_spider: public handler
ha_rows *dup_key_found
);
int end_bulk_update();
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
int bulk_update_row(
const uchar *old_data,
const uchar *new_data,
......@@ -585,31 +586,92 @@ class ha_spider: public handler
const uchar *old_data,
const uchar *new_data
);
#else
int bulk_update_row(
const uchar *old_data,
uchar *new_data,
ha_rows *dup_key_found
);
int update_row(
const uchar *old_data,
uchar *new_data
);
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
inline int direct_update_rows_init(List<Item> *update_fields)
{
#ifdef SPIDER_MDEV_16246
inline int direct_update_rows_init(
List<Item> *update_fields
) {
return direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL);
}
int direct_update_rows_init(List<Item> *update_fields, uint mode,
KEY_MULTI_RANGE *ranges, uint range_count,
bool sorted, const uchar *new_data);
int direct_update_rows_init(
List<Item> *update_fields,
uint mode,
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted,
uchar *new_data
);
#else
inline int direct_update_rows_init()
{
return direct_update_rows_init(2, NULL, 0, FALSE, NULL);
}
int direct_update_rows_init(
uint mode,
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted,
uchar *new_data
);
#endif
#else
int direct_update_rows_init(List<Item> *update_fields);
#ifdef SPIDER_MDEV_16246
int direct_update_rows_init(
List<Item> *update_fields
);
#else
int direct_update_rows_init();
#endif
#endif
#ifdef HA_CAN_BULK_ACCESS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
inline int pre_direct_update_rows_init(List<Item> *update_fields)
#ifdef SPIDER_MDEV_16246
inline int pre_direct_update_rows_init(
List<Item> *update_fields
) {
return pre_direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL);
}
int pre_direct_update_rows_init(
List<Item> *update_fields,
uint mode,
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted,
uchar *new_data
);
#else
inline int pre_direct_update_rows_init()
{
return pre_direct_update_rows_init(update_fields,
2, NULL, 0, FALSE, NULL);
return pre_direct_update_rows_init(2, NULL, 0, FALSE, NULL);
}
int pre_direct_update_rows_init(List<Item> *update_fields,
uint mode, KEY_MULTI_RANGE *ranges,
uint range_count, bool sorted,
uchar *new_data);
int pre_direct_update_rows_init(
uint mode,
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted,
uchar *new_data
);
#endif
#else
int pre_direct_update_rows_init(List<Item> *update_fields);
#ifdef SPIDER_MDEV_16246
int pre_direct_update_rows_init(
List<Item> *update_fields
);
#else
int pre_direct_update_rows_init();
#endif
#endif
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
......
/* Copyright (C) 2013 Kentoku Shiba
/* Copyright (C) 2013-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
let $CHILD2_1_SELECT_ARGUMENT1=
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
--let $OUTPUT_CHILD_GROUP2= 1
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
--let $USE_GENERAL_LOG= 1
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
let $CHILD2_1_SELECT_ARGUMENT1=
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
--let $OUTPUT_CHILD_GROUP2= 1
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
--let $USE_GENERAL_LOG= 1
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
let $CHILD2_1_SELECT_ARGUMENT1=
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
--let $OUTPUT_CHILD_GROUP2= 1
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
--let $USE_GENERAL_LOG= 1
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
let $CHILD2_1_SELECT_ARGUMENT1=
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
--let $OUTPUT_CHILD_GROUP2= 1
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
--let $USE_GENERAL_LOG= 1
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
let $CHILD2_1_SELECT_ARGUMENT1=
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
--let $OUTPUT_CHILD_GROUP2= 1
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
--let $USE_GENERAL_LOG= 1
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
let $CHILD2_1_SELECT_ARGUMENT1=
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
--let $OUTPUT_CHILD_GROUP2= 1
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
--let $USE_GENERAL_LOG= 1
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
let $CHILD2_1_SELECT_ARGUMENT1=
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
--let $OUTPUT_CHILD_GROUP2= 1
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
--let $USE_GENERAL_LOG= 1
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
let $CHILD2_1_SELECT_ARGUMENT1=
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
--let $OUTPUT_CHILD_GROUP2= 1
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
--let $USE_GENERAL_LOG= 1
--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
let $CHILD2_1_SELECT_ARGUMENT1=
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
--let $OUTPUT_CHILD_GROUP2= 1
--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
--let $USE_GENERAL_LOG= 1
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
test select 1
connection master_1;
SELECT 1;
1
1
connection child2_1;
SELECT 1;
1
1
create table and insert
connection child2_1;
CHILD2_1_DROP_TABLES
CHILD2_1_DROP_TABLES6
CHILD2_1_DROP_TABLES5
CHILD2_1_CREATE_TABLES
CHILD2_1_CREATE_TABLES6
CHILD2_1_CREATE_TABLES5
TRUNCATE TABLE mysql.general_log;
connection master_1;
DROP TABLE IF EXISTS tbl_a;
CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
PRIMARY KEY(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b INT DEFAULT 10,
c INT DEFAULT 11,
PRIMARY KEY(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
select test
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
a b c
5 50 500
4 40 400
3 30 300
2 20 200
1 10 100
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0,`auto_test_remote`.`ta_r_3` t1,`auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2000-01-01 00:00:00
2 b 2000-01-02 00:00:00
3 c 2000-01-03 00:00:00
4 d 2000-01-04 00:00:00
5 e 2000-01-05 00:00:00
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
end of test
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
test select 1
connection master_1;
SELECT 1;
1
1
connection child2_1;
SELECT 1;
1
1
create table and insert
connection child2_1;
CHILD2_1_DROP_TABLES
CHILD2_1_DROP_TABLES6
CHILD2_1_DROP_TABLES5
CHILD2_1_CREATE_TABLES
CHILD2_1_CREATE_TABLES6
CHILD2_1_CREATE_TABLES5
TRUNCATE TABLE mysql.general_log;
connection master_1;
DROP TABLE IF EXISTS tbl_a;
CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
PRIMARY KEY(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b INT DEFAULT 10,
c INT DEFAULT 11,
PRIMARY KEY(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
select test
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
a b c
5 50 500
4 40 400
3 30 300
2 20 200
1 10 100
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`a` = t0.`a`) left join `auto_test_remote`.`ta_r_int` t2 on (t2.`a` = t0.`a`) where 1 order by t0.`b` desc
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2000-01-01 00:00:00
2 b 2000-01-02 00:00:00
3 c 2000-01-03 00:00:00
4 d 2000-01-04 00:00:00
5 e 2000-01-05 00:00:00
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
end of test
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
test select 1
connection master_1;
SELECT 1;
1
1
connection child2_1;
SELECT 1;
1
1
create table and insert
connection child2_1;
CHILD2_1_DROP_TABLES
CHILD2_1_DROP_TABLES6
CHILD2_1_DROP_TABLES4
CHILD2_1_DROP_TABLES3
CHILD2_1_CREATE_TABLES
CHILD2_1_CREATE_TABLES6
CHILD2_1_CREATE_TABLES4
CHILD2_1_CREATE_TABLES3
TRUNCATE TABLE mysql.general_log;
connection master_1;
DROP TABLE IF EXISTS tbl_a;
CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
select test
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC;
a b c a
5 NULL NULL NULL
4 NULL NULL NULL
3 c 2000-01-03 00:00:00 NULL
2 b 2000-01-02 00:00:00 2
1 a 2000-01-01 00:00:00 1
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t0 left join `auto_test_remote`.`ta_r_auto_inc` t1 on ((t1.`a` = t0.`a`) and (t0.`a` is not null)) left join `auto_test_remote`.`ta_r_3` t2 on (t2.`c` = t1.`c`) left join `auto_test_remote`.`ta_r` t3 on ((t3.`b` = t2.`b`) and (t2.`b` is not null)) where 1 order by t0.`a` desc
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2000-01-01 00:00:00
2 b 2000-01-02 00:00:00
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
end of test
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
test select 1
connection master_1;
SELECT 1;
1
1
connection child2_1;
SELECT 1;
1
1
create table and insert
connection child2_1;
CHILD2_1_DROP_TABLES
CHILD2_1_DROP_TABLES6
CHILD2_1_DROP_TABLES4
CHILD2_1_DROP_TABLES3
CHILD2_1_CREATE_TABLES
CHILD2_1_CREATE_TABLES6
CHILD2_1_CREATE_TABLES4
CHILD2_1_CREATE_TABLES3
TRUNCATE TABLE mysql.general_log;
connection master_1;
DROP TABLE IF EXISTS tbl_a;
CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
select test
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
a b c a
NULL NULL NULL 5
NULL NULL NULL 4
NULL NULL NULL 3
2 b 2000-01-02 00:00:00 2
1 a 2000-01-01 00:00:00 1
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t2.`b` = t3.`b`) and (t2.`c` = t1.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null) and (t3.`b` is not null)) where 1 order by t3.`a` desc
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2000-01-01 00:00:00
2 b 2000-01-02 00:00:00
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
end of test
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
test select 1
connection master_1;
SELECT 1;
1
1
connection child2_1;
SELECT 1;
1
1
create table and insert
connection child2_1;
CHILD2_1_DROP_TABLES
CHILD2_1_DROP_TABLES6
CHILD2_1_DROP_TABLES4
CHILD2_1_DROP_TABLES3
CHILD2_1_CREATE_TABLES
CHILD2_1_CREATE_TABLES6
CHILD2_1_CREATE_TABLES4
CHILD2_1_CREATE_TABLES3
TRUNCATE TABLE mysql.general_log;
connection master_1;
DROP TABLE IF EXISTS tbl_a;
CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
select test
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
a b c a
NULL d 2000-01-04 00:00:00 4
NULL c 2000-01-03 00:00:00 3
2 b 2000-01-02 00:00:00 2
1 a 2000-01-01 00:00:00 1
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_auto_inc` t2 left join (`auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t1.`c` = t2.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null)) left join `auto_test_remote`.`ta_r_no_idx` t3 on (t3.`b` = t2.`b`) where 1 order by t3.`a` desc
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2000-01-01 00:00:00
2 b 2000-01-02 00:00:00
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
end of test
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
test select 1
connection master_1;
SELECT 1;
1
1
connection child2_1;
SELECT 1;
1
1
create table and insert
connection child2_1;
CHILD2_1_DROP_TABLES
CHILD2_1_DROP_TABLES6
CHILD2_1_DROP_TABLES5
CHILD2_1_CREATE_TABLES
CHILD2_1_CREATE_TABLES6
CHILD2_1_CREATE_TABLES5
TRUNCATE TABLE mysql.general_log;
connection master_1;
DROP TABLE IF EXISTS tbl_a;
CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
PRIMARY KEY(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b INT DEFAULT 10,
c INT DEFAULT 11,
PRIMARY KEY(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
select test
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
a b c
5 50 500
4 40 400
3 30 300
2 20 200
1 10 100
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r_int` t2 left join (`auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1) on ((t0.`a` = t2.`a`) and (t1.`a` = t2.`a`)) where 1 order by t0.`b` desc
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2000-01-01 00:00:00
2 b 2000-01-02 00:00:00
3 c 2000-01-03 00:00:00
4 d 2000-01-04 00:00:00
5 e 2000-01-05 00:00:00
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
end of test
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
test select 1
connection master_1;
SELECT 1;
1
1
connection child2_1;
SELECT 1;
1
1
create table and insert
connection child2_1;
CHILD2_1_DROP_TABLES
CHILD2_1_DROP_TABLES6
CHILD2_1_DROP_TABLES4
CHILD2_1_DROP_TABLES3
CHILD2_1_CREATE_TABLES
CHILD2_1_CREATE_TABLES6
CHILD2_1_CREATE_TABLES4
CHILD2_1_CREATE_TABLES3
TRUNCATE TABLE mysql.general_log;
connection master_1;
DROP TABLE IF EXISTS tbl_a;
CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
select test
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
a b c a
NULL NULL NULL 5
NULL d 2000-01-04 00:00:00 4
NULL c 2000-01-03 00:00:00 3
2 b 2000-01-02 00:00:00 2
1 a 2000-01-01 00:00:00 1
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join `auto_test_remote`.`ta_r_auto_inc` t2 on ((t2.`b` = t3.`b`) and (t3.`b` is not null)) left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) where 1 order by t3.`a` desc
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2000-01-01 00:00:00
2 b 2000-01-02 00:00:00
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
end of test
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
test select 1
connection master_1;
SELECT 1;
1
1
connection child2_1;
SELECT 1;
1
1
create table and insert
connection child2_1;
CHILD2_1_DROP_TABLES
CHILD2_1_DROP_TABLES6
CHILD2_1_DROP_TABLES4
CHILD2_1_DROP_TABLES3
CHILD2_1_CREATE_TABLES
CHILD2_1_CREATE_TABLES6
CHILD2_1_CREATE_TABLES4
CHILD2_1_CREATE_TABLES3
TRUNCATE TABLE mysql.general_log;
connection master_1;
DROP TABLE IF EXISTS tbl_a;
CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
select test
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
a b c a
NULL d 2000-01-04 00:00:00 4
NULL c 2000-01-03 00:00:00 3
2 b 2000-01-02 00:00:00 2
1 a 2000-01-01 00:00:00 1
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_auto_inc` t2 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) left join `auto_test_remote`.`ta_r_no_idx` t3 on (t3.`b` = t2.`b`) where 1 order by t3.`a` desc
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2000-01-01 00:00:00
2 b 2000-01-02 00:00:00
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
end of test
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
test select 1
connection master_1;
SELECT 1;
1
1
connection child2_1;
SELECT 1;
1
1
create table and insert
connection child2_1;
CHILD2_1_DROP_TABLES
CHILD2_1_DROP_TABLES6
CHILD2_1_DROP_TABLES4
CHILD2_1_DROP_TABLES3
CHILD2_1_CREATE_TABLES
CHILD2_1_CREATE_TABLES6
CHILD2_1_CREATE_TABLES4
CHILD2_1_CREATE_TABLES3
TRUNCATE TABLE mysql.general_log;
connection master_1;
DROP TABLE IF EXISTS tbl_a;
CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
select test
connection child2_1;
TRUNCATE TABLE mysql.general_log;
connection master_1;
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
a b c a
NULL NULL NULL 5
NULL NULL NULL 4
NULL c 2000-01-03 00:00:00 3
2 b 2000-01-02 00:00:00 2
1 a 2000-01-01 00:00:00 1
connection child2_1;
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null))) on ((t2.`b` = t3.`b`) and (t2.`c` = t1.`c`) and (t3.`b` is not null)) where 1 order by t3.`a` desc
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
a b date_format(c, '%Y-%m-%d %H:%i:%s')
1 a 2000-01-01 00:00:00
2 b 2000-01-02 00:00:00
deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
SET GLOBAL log_output = @old_log_output;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
end of test
--source ../include/direct_join_using_init.inc
--echo
--echo drop and create databases
--connection master_1
--disable_warnings
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
if ($USE_GENERAL_LOG)
{
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
}
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo create table and insert
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES;
echo CHILD2_1_DROP_TABLES6;
echo CHILD2_1_DROP_TABLES5;
echo CHILD2_1_CREATE_TABLES;
echo CHILD2_1_CREATE_TABLES6;
echo CHILD2_1_CREATE_TABLES5;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES;
eval $CHILD2_1_DROP_TABLES6;
eval $CHILD2_1_DROP_TABLES5;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES;
eval $CHILD2_1_CREATE_TABLES6;
eval $CHILD2_1_CREATE_TABLES5;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_warnings
DROP TABLE IF EXISTS tbl_a;
--enable_warnings
--disable_query_log
echo CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
PRIMARY KEY(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
PRIMARY KEY(a),
KEY idx1(b)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
echo CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
eval CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
echo CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b INT DEFAULT 10,
c INT DEFAULT 11,
PRIMARY KEY(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
eval CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b INT DEFAULT 10,
c INT DEFAULT 11,
PRIMARY KEY(a),
KEY idx1(b),
KEY idx2(c)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
--enable_query_log
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
--echo
--echo select test
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
if ($USE_GENERAL_LOG)
{
SET GLOBAL log_output = @old_log_output;
}
}
--enable_warnings
--source ../include/direct_join_using_deinit.inc
--echo
--echo end of test
--source ../include/direct_left_join_init.inc
--echo
--echo drop and create databases
--connection master_1
--disable_warnings
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
if ($USE_GENERAL_LOG)
{
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
}
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo create table and insert
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES;
echo CHILD2_1_DROP_TABLES6;
echo CHILD2_1_DROP_TABLES5;
echo CHILD2_1_CREATE_TABLES;
echo CHILD2_1_CREATE_TABLES6;
echo CHILD2_1_CREATE_TABLES5;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES;
eval $CHILD2_1_DROP_TABLES6;
eval $CHILD2_1_DROP_TABLES5;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES;
eval $CHILD2_1_CREATE_TABLES6;
eval $CHILD2_1_CREATE_TABLES5;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_warnings
DROP TABLE IF EXISTS tbl_a;
--enable_warnings
--disable_query_log
echo CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
PRIMARY KEY(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
PRIMARY KEY(a),
KEY idx1(b)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
echo CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
eval CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
echo CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b INT DEFAULT 10,
c INT DEFAULT 11,
PRIMARY KEY(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
eval CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b INT DEFAULT 10,
c INT DEFAULT 11,
PRIMARY KEY(a),
KEY idx1(b),
KEY idx2(c)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
--enable_query_log
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
--echo
--echo select test
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
if ($USE_GENERAL_LOG)
{
SET GLOBAL log_output = @old_log_output;
}
}
--enable_warnings
--source ../include/direct_left_join_deinit.inc
--echo
--echo end of test
--source ../include/direct_left_join_nullable_init.inc
--echo
--echo drop and create databases
--connection master_1
--disable_warnings
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
if ($USE_GENERAL_LOG)
{
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
}
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo create table and insert
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES;
echo CHILD2_1_DROP_TABLES6;
echo CHILD2_1_DROP_TABLES4;
echo CHILD2_1_DROP_TABLES3;
echo CHILD2_1_CREATE_TABLES;
echo CHILD2_1_CREATE_TABLES6;
echo CHILD2_1_CREATE_TABLES4;
echo CHILD2_1_CREATE_TABLES3;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES;
eval $CHILD2_1_DROP_TABLES6;
eval $CHILD2_1_DROP_TABLES4;
eval $CHILD2_1_DROP_TABLES3;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES;
eval $CHILD2_1_CREATE_TABLES6;
eval $CHILD2_1_CREATE_TABLES4;
eval $CHILD2_1_CREATE_TABLES3;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_warnings
DROP TABLE IF EXISTS tbl_a;
--enable_warnings
--disable_query_log
echo CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
echo CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
eval CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
echo CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
eval CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
echo CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
eval CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
--enable_query_log
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
--echo
--echo select test
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
if ($USE_GENERAL_LOG)
{
SET GLOBAL log_output = @old_log_output;
}
}
--enable_warnings
--source ../include/direct_left_join_nullable_deinit.inc
--echo
--echo end of test
--source ../include/direct_left_right_join_nullable_init.inc
--echo
--echo drop and create databases
--connection master_1
--disable_warnings
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
if ($USE_GENERAL_LOG)
{
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
}
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo create table and insert
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES;
echo CHILD2_1_DROP_TABLES6;
echo CHILD2_1_DROP_TABLES4;
echo CHILD2_1_DROP_TABLES3;
echo CHILD2_1_CREATE_TABLES;
echo CHILD2_1_CREATE_TABLES6;
echo CHILD2_1_CREATE_TABLES4;
echo CHILD2_1_CREATE_TABLES3;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES;
eval $CHILD2_1_DROP_TABLES6;
eval $CHILD2_1_DROP_TABLES4;
eval $CHILD2_1_DROP_TABLES3;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES;
eval $CHILD2_1_CREATE_TABLES6;
eval $CHILD2_1_CREATE_TABLES4;
eval $CHILD2_1_CREATE_TABLES3;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_warnings
DROP TABLE IF EXISTS tbl_a;
--enable_warnings
--disable_query_log
echo CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
echo CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
eval CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
echo CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
eval CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
echo CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
eval CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
--enable_query_log
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
--echo
--echo select test
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
if ($USE_GENERAL_LOG)
{
SET GLOBAL log_output = @old_log_output;
}
}
--enable_warnings
--source ../include/direct_left_right_join_nullable_deinit.inc
--echo
--echo end of test
--source ../include/direct_left_right_left_join_nullable_init.inc
--echo
--echo drop and create databases
--connection master_1
--disable_warnings
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
if ($USE_GENERAL_LOG)
{
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
}
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo create table and insert
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES;
echo CHILD2_1_DROP_TABLES6;
echo CHILD2_1_DROP_TABLES4;
echo CHILD2_1_DROP_TABLES3;
echo CHILD2_1_CREATE_TABLES;
echo CHILD2_1_CREATE_TABLES6;
echo CHILD2_1_CREATE_TABLES4;
echo CHILD2_1_CREATE_TABLES3;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES;
eval $CHILD2_1_DROP_TABLES6;
eval $CHILD2_1_DROP_TABLES4;
eval $CHILD2_1_DROP_TABLES3;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES;
eval $CHILD2_1_CREATE_TABLES6;
eval $CHILD2_1_CREATE_TABLES4;
eval $CHILD2_1_CREATE_TABLES3;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_warnings
DROP TABLE IF EXISTS tbl_a;
--enable_warnings
--disable_query_log
echo CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
echo CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
eval CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
echo CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
eval CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
echo CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
eval CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
--enable_query_log
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
--echo
--echo select test
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
if ($USE_GENERAL_LOG)
{
SET GLOBAL log_output = @old_log_output;
}
}
--enable_warnings
--source ../include/direct_left_right_left_join_nullable_deinit.inc
--echo
--echo end of test
--source ../include/direct_right_join_init.inc
--echo
--echo drop and create databases
--connection master_1
--disable_warnings
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
if ($USE_GENERAL_LOG)
{
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
}
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo create table and insert
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES;
echo CHILD2_1_DROP_TABLES6;
echo CHILD2_1_DROP_TABLES5;
echo CHILD2_1_CREATE_TABLES;
echo CHILD2_1_CREATE_TABLES6;
echo CHILD2_1_CREATE_TABLES5;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES;
eval $CHILD2_1_DROP_TABLES6;
eval $CHILD2_1_DROP_TABLES5;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES;
eval $CHILD2_1_CREATE_TABLES6;
eval $CHILD2_1_CREATE_TABLES5;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_warnings
DROP TABLE IF EXISTS tbl_a;
--enable_warnings
--disable_query_log
echo CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
PRIMARY KEY(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
PRIMARY KEY(a),
KEY idx1(b)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
echo CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
eval CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
echo CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b INT DEFAULT 10,
c INT DEFAULT 11,
PRIMARY KEY(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
eval CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b INT DEFAULT 10,
c INT DEFAULT 11,
PRIMARY KEY(a),
KEY idx1(b),
KEY idx2(c)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
--enable_query_log
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
--echo
--echo select test
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
if ($USE_GENERAL_LOG)
{
SET GLOBAL log_output = @old_log_output;
}
}
--enable_warnings
--source ../include/direct_right_join_deinit.inc
--echo
--echo end of test
--source ../include/direct_right_join_nullable_init.inc
--echo
--echo drop and create databases
--connection master_1
--disable_warnings
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
if ($USE_GENERAL_LOG)
{
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
}
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo create table and insert
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES;
echo CHILD2_1_DROP_TABLES6;
echo CHILD2_1_DROP_TABLES4;
echo CHILD2_1_DROP_TABLES3;
echo CHILD2_1_CREATE_TABLES;
echo CHILD2_1_CREATE_TABLES6;
echo CHILD2_1_CREATE_TABLES4;
echo CHILD2_1_CREATE_TABLES3;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES;
eval $CHILD2_1_DROP_TABLES6;
eval $CHILD2_1_DROP_TABLES4;
eval $CHILD2_1_DROP_TABLES3;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES;
eval $CHILD2_1_CREATE_TABLES6;
eval $CHILD2_1_CREATE_TABLES4;
eval $CHILD2_1_CREATE_TABLES3;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_warnings
DROP TABLE IF EXISTS tbl_a;
--enable_warnings
--disable_query_log
echo CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
echo CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
eval CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
echo CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
eval CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
echo CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
eval CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
--enable_query_log
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
--echo
--echo select test
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
if ($USE_GENERAL_LOG)
{
SET GLOBAL log_output = @old_log_output;
}
}
--enable_warnings
--source ../include/direct_right_join_nullable_deinit.inc
--echo
--echo end of test
--source ../include/direct_right_left_join_nullable_init.inc
--echo
--echo drop and create databases
--connection master_1
--disable_warnings
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
if ($USE_GENERAL_LOG)
{
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
}
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo create table and insert
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES;
echo CHILD2_1_DROP_TABLES6;
echo CHILD2_1_DROP_TABLES4;
echo CHILD2_1_DROP_TABLES3;
echo CHILD2_1_CREATE_TABLES;
echo CHILD2_1_CREATE_TABLES6;
echo CHILD2_1_CREATE_TABLES4;
echo CHILD2_1_CREATE_TABLES3;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES;
eval $CHILD2_1_DROP_TABLES6;
eval $CHILD2_1_DROP_TABLES4;
eval $CHILD2_1_DROP_TABLES3;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES;
eval $CHILD2_1_CREATE_TABLES6;
eval $CHILD2_1_CREATE_TABLES4;
eval $CHILD2_1_CREATE_TABLES3;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_warnings
DROP TABLE IF EXISTS tbl_a;
--enable_warnings
--disable_query_log
echo CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
echo CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
eval CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
echo CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
eval CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
echo CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
eval CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
--enable_query_log
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
--echo
--echo select test
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
if ($USE_GENERAL_LOG)
{
SET GLOBAL log_output = @old_log_output;
}
}
--enable_warnings
--source ../include/direct_right_left_join_nullable_deinit.inc
--echo
--echo end of test
--source ../include/direct_right_left_right_join_nullable_init.inc
--echo
--echo drop and create databases
--connection master_1
--disable_warnings
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
if ($USE_GENERAL_LOG)
{
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = 'TABLE,FILE';
}
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
}
--enable_warnings
--echo
--echo test select 1
--connection master_1
SELECT 1;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
SELECT 1;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo create table and insert
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($OUTPUT_CHILD_GROUP2)
{
--disable_query_log
echo CHILD2_1_DROP_TABLES;
echo CHILD2_1_DROP_TABLES6;
echo CHILD2_1_DROP_TABLES4;
echo CHILD2_1_DROP_TABLES3;
echo CHILD2_1_CREATE_TABLES;
echo CHILD2_1_CREATE_TABLES6;
echo CHILD2_1_CREATE_TABLES4;
echo CHILD2_1_CREATE_TABLES3;
}
--disable_warnings
eval $CHILD2_1_DROP_TABLES;
eval $CHILD2_1_DROP_TABLES6;
eval $CHILD2_1_DROP_TABLES4;
eval $CHILD2_1_DROP_TABLES3;
--enable_warnings
eval $CHILD2_1_CREATE_TABLES;
eval $CHILD2_1_CREATE_TABLES6;
eval $CHILD2_1_CREATE_TABLES4;
eval $CHILD2_1_CREATE_TABLES3;
if ($OUTPUT_CHILD_GROUP2)
{
--enable_query_log
}
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
--disable_warnings
DROP TABLE IF EXISTS tbl_a;
--enable_warnings
--disable_query_log
echo CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
echo CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
eval CREATE TABLE tbl_b (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
echo CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
eval CREATE TABLE tbl_c (
a INT AUTO_INCREMENT,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
KEY idx0(a),
KEY idx1(b),
KEY idx2(c)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
echo CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
eval CREATE TABLE tbl_d (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10'
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
--enable_query_log
insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
--echo
--echo select test
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
TRUNCATE TABLE mysql.general_log;
}
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--connection master_1
SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
if ($USE_CHILD_GROUP2)
{
if (!$OUTPUT_CHILD_GROUP2)
{
--disable_query_log
--disable_result_log
}
--connection child2_1
if ($USE_GENERAL_LOG)
{
eval $CHILD2_1_SELECT_ARGUMENT1;
}
eval $CHILD2_1_SELECT_TABLES;
if (!$OUTPUT_CHILD_GROUP2)
{
--enable_query_log
--enable_result_log
}
}
--echo
--echo deinit
--disable_warnings
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
if ($USE_CHILD_GROUP2)
{
--connection child2_1
DROP DATABASE IF EXISTS auto_test_remote;
if ($USE_GENERAL_LOG)
{
SET GLOBAL log_output = @old_log_output;
}
}
--enable_warnings
--source ../include/direct_right_left_right_join_nullable_deinit.inc
--echo
--echo end of test
# Copyright (C) 2010-2016 Kentoku Shiba
# Copyright (C) 2010-2018 Kentoku Shiba
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -167,8 +167,8 @@ drop procedure if exists mysql.spider_fix_system_tables;
delimiter //
create procedure mysql.spider_fix_one_table
(tab_name char(255) charset utf8 collate utf8_bin,
test_col_name char(255) charset utf8 collate utf8_bin,
_sql text charset utf8 collate utf8_bin)
test_col_name char(255) charset utf8 collate utf8_bin,
_sql text charset utf8 collate utf8_bin)
begin
set @col_exists := 0;
select 1 into @col_exists from INFORMATION_SCHEMA.COLUMNS
......@@ -184,6 +184,13 @@ end;//
create procedure mysql.spider_fix_system_tables()
begin
select substring_index(substring_index(version(), '-', 2), '-', -1)
into @server_name;
select substring_index(version(), '.', 1)
into @server_major_version;
select substring_index(substring_index(version(), '.', 2), '.', -1)
into @server_minor_version;
-- Fix for 0.5
call mysql.spider_fix_one_table('spider_tables', 'server',
'alter table mysql.spider_tables
......@@ -402,68 +409,78 @@ begin
end if;
-- Fix for MariaDB 10.4: Crash-Safe system tables
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_link_failed_log';
if @server_name = 'MariaDB' and
(
@server_major_version > 10 or
(
@server_major_version = 10 and
@server_minor_version >= 4
)
)
then
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_link_failed_log';
if @engine_name != 'Aria' then
alter table mysql.spider_link_failed_log
engine=Aria transactional=1;
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_link_mon_servers';
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_link_mon_servers';
if @engine_name != 'Aria' then
alter table mysql.spider_link_mon_servers
engine=Aria transactional=1;
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_table_crd';
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_table_crd';
if @engine_name != 'Aria' then
alter table mysql.spider_table_crd
engine=Aria transactional=1;
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_table_position_for_recovery';
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_table_position_for_recovery';
if @engine_name != 'Aria' then
alter table mysql.spider_table_position_for_recovery
engine=Aria transactional=1;
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_table_sts';
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_table_sts';
if @engine_name != 'Aria' then
alter table mysql.spider_table_sts
engine=Aria transactional=1;
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_tables';
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_tables';
if @engine_name != 'Aria' then
alter table mysql.spider_tables
engine=Aria transactional=1;
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_xa';
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_xa';
if @engine_name != 'Aria' then
alter table mysql.spider_xa
engine=Aria transactional=1;
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_xa_failed_log';
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_xa_failed_log';
if @engine_name != 'Aria' then
alter table mysql.spider_xa_failed_log
engine=Aria transactional=1;
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_xa_member';
end if;
select ENGINE INTO @engine_name from INFORMATION_SCHEMA.TABLES
where TABLE_SCHEMA = 'mysql'
AND TABLE_NAME = 'spider_xa_member';
if @engine_name != 'Aria' then
alter table mysql.spider_xa_member
engine=Aria transactional=1;
end if;
end if;
end;//
delimiter ;
......
/* Copyright (C) 2008-2017 Kentoku Shiba
/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -1439,9 +1439,10 @@ void spider_conn_queue_time_zone(
DBUG_VOID_RETURN;
}
void spider_conn_queue_UTC_time_zone(SPIDER_CONN *conn)
{
DBUG_ENTER("spider_conn_queue_time_zone");
void spider_conn_queue_UTC_time_zone(
SPIDER_CONN *conn
) {
DBUG_ENTER("spider_conn_queue_UTC_time_zone");
DBUG_PRINT("info", ("spider conn=%p", conn));
spider_conn_queue_time_zone(conn, UTC);
DBUG_VOID_RETURN;
......
/* Copyright (C) 2008-2017 Kentoku Shiba
/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -13,8 +13,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "tztime.h"
#define SPIDER_LOCK_MODE_NO_LOCK 0
#define SPIDER_LOCK_MODE_SHARED 1
#define SPIDER_LOCK_MODE_EXCLUSIVE 2
......
/* Copyright (C) 2009-2017 Kentoku Shiba
/* Copyright (C) 2009-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -53,10 +53,10 @@ int spider_udf_set_copy_tables_param_default(
if (!copy_tables->database)
{
DBUG_PRINT("info",("spider create default database"));
copy_tables->database_length = copy_tables->trx->thd->db.length;
copy_tables->database_length = SPIDER_THD_db_length(copy_tables->trx->thd);
if (
!(copy_tables->database = spider_create_string(
copy_tables->trx->thd->db.str,
SPIDER_THD_db_str(copy_tables->trx->thd),
copy_tables->database_length))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
......@@ -90,8 +90,7 @@ int spider_udf_set_copy_tables_param_default(
start_ptr, TRUE, &param_string_parse))) \
copy_tables->SPIDER_PARAM_STR_LEN(param_name) = \
strlen(copy_tables->param_name); \
else \
{ \
else { \
error_num = param_string_parse.print_param_error(); \
goto error; \
} \
......@@ -968,19 +967,25 @@ long long spider_copy_tables_body(
goto error;
table_list = &copy_tables->spider_table_list;
table_list->db.str = copy_tables->spider_db_name;
table_list->db.length = copy_tables->spider_db_name_length;
table_list->alias.str = table_list->table_name.str =
SPIDER_TABLE_LIST_db_str(table_list) = copy_tables->spider_db_name;
SPIDER_TABLE_LIST_db_length(table_list) = copy_tables->spider_db_name_length;
SPIDER_TABLE_LIST_alias_str(table_list) =
SPIDER_TABLE_LIST_table_name_str(table_list) =
copy_tables->spider_real_table_name;
table_list->table_name.length = copy_tables->spider_real_table_name_length;
table_list->alias.length= table_list->table_name.length;
SPIDER_TABLE_LIST_table_name_length(table_list) =
copy_tables->spider_real_table_name_length;
#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
SPIDER_TABLE_LIST_alias_length(table_list) =
SPIDER_TABLE_LIST_table_name_length(table_list);
#endif
table_list->lock_type = TL_READ;
DBUG_PRINT("info",("spider db=%s", table_list->db.str));
DBUG_PRINT("info",("spider db_length=%zd", table_list->db.length));
DBUG_PRINT("info",("spider table_name=%s", table_list->table_name.str));
DBUG_PRINT("info",("spider db=%s", SPIDER_TABLE_LIST_db_str(table_list)));
DBUG_PRINT("info",("spider db_length=%zd", SPIDER_TABLE_LIST_db_length(table_list)));
DBUG_PRINT("info",("spider table_name=%s",
SPIDER_TABLE_LIST_table_name_str(table_list)));
DBUG_PRINT("info",("spider table_name_length=%zd",
table_list->table_name.length));
SPIDER_TABLE_LIST_table_name_length(table_list)));
reprepare_observer_backup = thd->m_reprepare_observer;
thd->m_reprepare_observer = NULL;
copy_tables->trx->trx_start = TRUE;
......@@ -991,8 +996,8 @@ long long spider_copy_tables_body(
#else
table_list->mdl_request.init(
MDL_key::TABLE,
table_list->db.str,
table_list->table_name.str,
SPIDER_TABLE_LIST_db_str(table_list),
SPIDER_TABLE_LIST_table_name_str(table_list),
MDL_SHARED_READ,
MDL_TRANSACTION
);
......@@ -1004,8 +1009,9 @@ long long spider_copy_tables_body(
copy_tables->trx->updated_in_this_trx = FALSE;
DBUG_PRINT("info",("spider trx->updated_in_this_trx=FALSE"));
my_printf_error(ER_SPIDER_UDF_CANT_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_OPEN_TABLE_STR, MYF(0), table_list->db,
table_list->table_name);
ER_SPIDER_UDF_CANT_OPEN_TABLE_STR, MYF(0),
SPIDER_TABLE_LIST_db_str(table_list),
SPIDER_TABLE_LIST_table_name_str(table_list));
goto error;
}
thd->m_reprepare_observer = reprepare_observer_backup;
......@@ -1019,7 +1025,8 @@ long long spider_copy_tables_body(
{
my_printf_error(ER_SPIDER_UDF_COPY_TABLE_NEED_PK_NUM,
ER_SPIDER_UDF_COPY_TABLE_NEED_PK_STR, MYF(0),
table_list->db, table_list->table_name);
SPIDER_TABLE_LIST_db_str(table_list),
SPIDER_TABLE_LIST_table_name_str(table_list));
goto error;
}
key_info = &table->key_info[table_share->primary_key];
......
This diff is collapsed.
/* Copyright (C) 2008-2017 Kentoku Shiba
/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -412,7 +412,20 @@ int spider_db_unlock_tables(
int spider_db_append_name_with_quote_str(
spider_string *str,
char *name,
const char *name,
uint dbton_id
);
int spider_db_append_name_with_quote_str(
spider_string *str,
LEX_CSTRING &name,
uint dbton_id
);
int spider_db_append_name_with_quote_str_internal(
spider_string *str,
const char *name,
int length,
uint dbton_id
);
......@@ -859,6 +872,12 @@ int spider_db_print_item_type(
spider_fields *fields
);
int spider_db_print_item_type_default(
Item *item,
ha_spider *spider,
spider_string *str
);
int spider_db_open_item_cond(
Item_cond *item_cond,
ha_spider *spider,
......
This diff is collapsed.
/* Copyright (C) 2012-2017 Kentoku Shiba
/* Copyright (C) 2012-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -119,8 +119,11 @@ class spider_db_handlersocket_util: public spider_db_util
);
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int append_from_and_tables(
ha_spider *spider,
spider_fields *fields,
spider_string *str
spider_string *str,
TABLE_LIST *table_list,
uint table_count
);
int reappend_tables(
spider_fields *fields,
......
/* Copyright (C) 2008-2017 Kentoku Shiba
/* Copyright (C) 2008-2018 Kentoku Shiba
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -17,7 +17,6 @@
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
#include "hstcpcli.hpp"
#endif
#include "tztime.h"
#define SPIDER_DBTON_SIZE 15
......@@ -703,6 +702,8 @@ class spider_fields
);
void set_pos_to_first_table_holder();
SPIDER_TABLE_HOLDER *get_next_table_holder();
SPIDER_TABLE_HOLDER *get_table_holder(TABLE *table);
uint get_table_count();
int add_field(Field *field_arg);
SPIDER_FIELD_HOLDER *create_field_holder();
void set_pos_to_first_field_holder();
......@@ -888,8 +889,11 @@ class spider_db_util
) = 0;
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
virtual int append_from_and_tables(
ha_spider *spider,
spider_fields *fields,
spider_string *str
spider_string *str,
TABLE_LIST *table_list,
uint table_count
) = 0;
virtual int reappend_tables(
spider_fields *fields,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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