summaryrefslogtreecommitdiff
path: root/storage/spider/mysql-test/spider/r/direct_join_using.result
blob: 66ae1503f9fe7e2497685dde49b1619a637f5813 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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