1#
2# WL#7755  mysqlpump: Extend mysqldump functionalities
3#
4Create database db1;
5Create database db2;
6CREATE DATABASE db3;
7CREATE DATABASE db1_1gb;
8USE db1;
9CREATE TABLE dt1 (a INT);
10CREATE TABLE dt2 (a INT, b VARCHAR(10), primary key(a));
11CREATE TABLE dt3 (`a"b"` char(2));
12INSERT INTO dt1 VALUES (289), (298), (234), (456), (789);
13INSERT INTO dt2 VALUES (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
14INSERT INTO dt3 VALUES ("1\""), ("\"2");
15CREATE TABLE categories(
16c_id int not null auto_increment primary key,
17c_name varchar(255) not null,
18c_description text,
19UNIQUE(c_id, c_name)
20) ENGINE=InnoDB;
21CREATE TABLE products(
22p_id int not null auto_increment primary key,
23p_name varchar(355) not null,
24p_price decimal,
25c_id int not null,
26FOREIGN KEY fk_categories(c_id)
27REFERENCES categories(c_id)
28ON UPDATE CASCADE
29ON DELETE RESTRICT
30)ENGINE=InnoDB;
31CREATE TABLE vendors(
32v_id int not null auto_increment primary key,
33v_name varchar(255)
34)ENGINE=InnoDB;
35ALTER TABLE products
36ADD COLUMN v_id int not null AFTER c_id;
37ALTER TABLE products
38ADD FOREIGN KEY fk_vendor(v_id)
39REFERENCES vendors(v_id)
40ON DELETE NO ACTION
41ON UPDATE CASCADE;
42CREATE VIEW v1 AS SELECT * FROM dt2;
43CREATE VIEW v2 AS SELECT * FROM dt1;
44CREATE VIEW v3 AS SELECT v1.*,v2.a as X FROM v1,v2;
45CREATE VIEW v11 AS SELECT * FROM v3;
46CREATE TEMPORARY TABLE t14 (id INT);
47CREATE TRIGGER trig1 BEFORE INSERT ON dt1 FOR EACH ROW SET NEW.a = 1;
48CREATE TRIGGER trig2 BEFORE UPDATE ON dt1 FOR EACH ROW SET NEW.a = 999;
49CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
50CREATE EVENT ev2 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
51CREATE PROCEDURE db1t_cache()
52BEGIN
53SET @A= 20;
54SELECT * FROM dt1;
55SELECT * FROM dt1;
56PREPARE x FROM 'SELECT 1';
57SELECT * FROM dt1;
58SELECT * FROM dt1;
59END ;|
60CREATE FUNCTION db1_f1 () RETURNS int
61BEGIN
62SET NAMES 'big5';
63RETURN (SELECT COUNT(*) FROM dt1);
64END ;|
65USE db2;
66CREATE TABLE d2t1 (
67id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
68fname VARCHAR(200) NOT NULL,
69lname  VARCHAR(60) ,
70phone VARCHAR(15) DEFAULT NULL,
71created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
72eid tinyint NOT NULL DEFAULT 011,
73PRIMARY KEY (id),
74UNIQUE(id,fname)
75)
76ENGINE = InnoDB;
77INSERT INTO d2t1 VALUES (1, "abc","","283682846",default,11), (2, "ed","adw\5\/fdfiw","wfdf%&$#^dif",default,26);
78INSERT INTO d2t1 (fname) VALUES("wgdugw");
79INSERT INTO d2t1 (fname,lname) VALUES("wgdugw","gdwsjdg");
80INSERT INTO d2t1 (fname,phone) VALUES("wgdugw","+2937280802*");
81ALTER TABLE d2t1 ADD INDEX d2t1_index4 (fname, eid ASC);
82ALTER TABLE d2t1 ADD INDEX d2t1_index5 (eid, fname);
83CREATE TABLE d2t2 (
84id INT PRIMARY KEY AUTO_INCREMENT,
85fname VARCHAR(200) NOT NULL,
86lname  VARCHAR(60) ,
87phone VARCHAR(15) DEFAULT NULL,
88created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
89eid tinyint NOT NULL DEFAULT 011,
90KEY d2t2_index2 (fname,eid),
91KEY d2t2_index3 (Id,eid)
92)
93ENGINE = InnoDB;
94INSERT INTO d2t2 VALUES (1, "abc","","283682846",default,13), (2, "ed","adw\5\/fdfiw","wfdf%&$#^dif",default,26);
95INSERT INTO d2t2 (fname) VALUES("wgdugw");
96INSERT INTO d2t2 (fname,lname) VALUES("wgdugw","gdwsjdg");
97INSERT INTO d2t2 (fname,phone) VALUES("wgdugw","+2937280802*");
98CREATE PROCEDURE d2t_cache()
99BEGIN
100SET @A= 20;
101SELECT * FROM d2t1;
102SELECT * FROM d2t1;
103PREPARE x FROM 'SELECT 1';
104SELECT * FROM d2t1;
105SELECT * FROM d2t1;
106END ;|
107CREATE FUNCTION d2f1 () RETURNS int
108BEGIN
109SET NAMES 'big5';
110RETURN (SELECT COUNT(*) FROM d2t1);
111END ;|
112
113USE db3;
114CREATE TABLE d3t1 (a INT);
115CREATE TABLE d3t2 (a INT, b VARCHAR(10), primary key(a));
116CREATE TABLE d3t3 (`a"b"` char(2));
117CREATE TABLE d3t4 (`x"z"` int,xyz varchar(20),notes text);
118ALTER TABLE d3t2 ADD INDEX d3t1_index4 (b ASC);
119ALTER TABLE d3t4 ADD INDEX d3t4_index5 (`x"z"`,xyz,notes(3));
120INSERT INTO d3t1 VALUES (289), (298), (234), (456), (789);
121INSERT INTO d3t2 VALUES (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
122INSERT INTO d3t3 VALUES ("1\""), ("\"2");
123INSERT INTO d3t4 VALUES (1, "on","note"), (2, "off","note1"), (10, "pol","note3"), (12, "meg","note4");
124CREATE TABLE parent (
125id INT NOT NULL,
126PRIMARY KEY (id)
127) ENGINE=INNODB;
128CREATE TABLE child (
129id INT,
130parent_id INT,
131INDEX par_ind (parent_id),
132FOREIGN KEY (parent_id)
133REFERENCES parent(id)
134ON DELETE CASCADE
135) ENGINE=INNODB;
136CREATE TABLE product (
137category INT NOT NULL, id INT NOT NULL,
138price DECIMAL,
139PRIMARY KEY(category, id)
140)   ENGINE=INNODB;
141CREATE TABLE customer (
142id INT NOT NULL,
143PRIMARY KEY (id)
144)   ENGINE=INNODB;
145CREATE TABLE product_order (
146no INT NOT NULL AUTO_INCREMENT,
147product_category INT NOT NULL,
148product_id INT NOT NULL,
149customer_id INT NOT NULL,
150PRIMARY KEY(no),
151INDEX (product_category, product_id),
152INDEX (customer_id),
153FOREIGN KEY (product_category, product_id)
154REFERENCES product(category, id)
155ON UPDATE CASCADE ON DELETE RESTRICT,
156FOREIGN KEY (customer_id)
157REFERENCES customer(id)
158)ENGINE=INNODB;
159CREATE VIEW v1 AS SELECT * FROM d3t2;
160CREATE VIEW v2 AS SELECT * FROM d3t1;
161CREATE VIEW v3 AS SELECT v1.*,v2.a as X FROM v1,v2;
162CREATE VIEW v11 AS SELECT * FROM v3;
163CREATE TEMPORARY TABLE t14 (id INT);
164CREATE TRIGGER trig3 BEFORE INSERT ON d3t1 FOR EACH ROW SET NEW.a = 1;
165CREATE TRIGGER trig4 BEFORE UPDATE ON d3t1 FOR EACH ROW SET NEW.a = 999;
166CREATE EVENT ev3 ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
167CREATE EVENT ev4 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
168CREATE PROCEDURE d3t_cache()
169BEGIN
170SET @A= 20;
171SELECT * FROM d3t1;
172SELECT * FROM d3t1;
173PREPARE x FROM 'SELECT 1';
174SELECT * FROM d3t1;
175SELECT * FROM d3t1;
176END ;|
177CREATE FUNCTION d3f1 () RETURNS int
178BEGIN
179SET NAMES 'big5';
180RETURN (SELECT COUNT(*) FROM d3t1);
181END ;|
182use db1_1gb;
183CREATE TABLE `db1_1gb`.`customer` (
184`C_CUSTKEY` int(11) NOT NULL,
185`C_NAME` varchar(25) NOT NULL,
186`C_ADDRESS` varchar(40) NOT NULL,
187`C_nationKEY` mediumint(9) NOT NULL,
188`C_PHONE` char(15) NOT NULL,
189`C_ACCTBAL` double(8,2) NOT NULL,
190`C_MKTSEGMENT` char(10) NOT NULL,
191`C_COMMENT` varchar(117) NOT NULL,
192`C_SUMMARY` mediumblob NOT NULL,
193`C_ISACTIVE` tinyint(1) DEFAULT NULL,
194PRIMARY KEY (`C_CUSTKEY`)
195) ENGINE=InnoDB DEFAULT CHARSET=latin1;
196ALTER TABLE `db1_1gb`.`customer` ADD FULLTEXT (`C_COMMENT`);
197Warnings:
198Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
199INSERT INTO `db1_1gb`.`customer` VALUES (1,"Customer#000000001","IVhzIApeRb ot,c,E",15,"25-989-741-2988",711.56,"BUILDING","to the even, regular platelets. regular, ironic epitaphs nag e","to the even, regular platelets. regular, ironic epitaphs nag e",1),(2,"Customer#000000002","XSTf4,NCwDVaWNe6tEgvwfmRchLXak",13,"23-768-687-3665",121.65,"AUTOMOBILE","l accounts. blithely ironic theodolites integrate boldly: caref","l accounts. blithely ironic theodolites integrate boldly: caref",1);
200ALTER TABLE `db1_1gb`.`customer` ADD KEY `c_name_index` (`C_NAME`);
201ALTER TABLE `db1_1gb`.`customer` ADD KEY `c_phone_index` (`C_PHONE`);
202CREATE TABLE `db1_1gb`.`lineitem` (
203`L_ORDERKEY` int(11) NOT NULL,
204`L_partKEY` int(11) NOT NULL,
205`L_SUPPKEY` int(11) NOT NULL,
206`L_LINENUMBER` bigint(20) NOT NULL,
207`L_QUANTITY` double NOT NULL,
208`L_EXTENDEDPRICE` decimal(15,2) NOT NULL,
209`L_DISCOUNT` float NOT NULL,
210`L_TAX` decimal(15,2) NOT NULL,
211`L_RETURNFLAG` char(1) DEFAULT NULL,
212`L_LINESTATUS` tinytext NOT NULL,
213`L_SHIPDATE` datetime NOT NULL,
214`L_COMMITDATE` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
215`L_RECEIPTDATE` date DEFAULT NULL,
216`L_SHIPINSTRUCT` text NOT NULL,
217`L_SHIPMODE` enum('ROAD','RAIL','SEA','AIR','TRUCK','MAIL','FOB','SHIP','REG AIR') DEFAULT NULL,
218`L_COMMENT` longtext NOT NULL,
219`L_TAGS` char(50) DEFAULT NULL,
220PRIMARY KEY (`L_ORDERKEY`,`L_LINENUMBER`)
221) ENGINE=InnoDB DEFAULT CHARSET=latin1;
222ALTER TABLE `db1_1gb`.`lineitem` ADD KEY `l_quantity_index` (`L_QUANTITY`);
223ALTER TABLE `db1_1gb`.`lineitem` ADD KEY `l_discount_index` (`L_DISCOUNT`);
224ALTER TABLE `db1_1gb`.`lineitem` ADD KEY `l_shipinstruct_index` (`L_SHIPINSTRUCT`(10));
225INSERT INTO `db1_1gb`.`lineitem` VALUES (5987,23,2,1,1,923.02,0.01,0.04,"N","O","1996-09-13 00:00:00","1996-10-29 00:00:00","1996-09-21","DELIVER IN PERSON","REG AIR","refully final excuses haggle furiously ag","REG AIR"),(5987,176,5,2,20,21523.40,0.1,0.06,"N","O","1996-11-28 00:00:00","1996-09-17 00:00:00","1996-12-05","TAKE BACK RETURN","RAIL","ing excuses nag quickly always bold","RAIL");
226CREATE TABLE `db1_1gb`.`nation` (
227`N_nationKEY` int(11) NOT NULL,
228`N_NAME` char(25) NOT NULL,
229`N_regionKEY` int(11) NOT NULL,
230`N_COMMENT` mediumtext,
231PRIMARY KEY (`N_nationKEY`)
232) ENGINE=InnoDB DEFAULT CHARSET=latin1;
233INSERT INTO `db1_1gb`.`nation` VALUES (0,"ALGERIA",0," haggle. carefully final deposits detect slyly agai"),(1,"ARGENTINA",1,"al foxes promise slyly according to the regular accounts. bold requests alon"),(2,"BRAZIL",1,"y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special "),(3,"CANADA",1,"eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold");
234CREATE TABLE `db1_1gb`.`orders` (
235`O_ORDERKEY` int(11) NOT NULL,
236`O_CUSTKEY` int(11) NOT NULL,
237`O_ordersTATUS` char(20) NOT NULL,
238`O_TOTALPRICE` decimal(15,2) NOT NULL,
239`O_ORDERDATE` date NOT NULL,
240`O_ORDERPRIORITY` char(15) NOT NULL,
241`O_CLERK` char(15) NOT NULL,
242`O_SHIPPRIORITY` tinyint(4) NOT NULL,
243`O_COMMENT` blob NOT NULL,
244`O_ORDERYEAR` year(4) NOT NULL,
245`O_SUMMARY` longblob NOT NULL,
246PRIMARY KEY (`O_ORDERKEY`)
247) ENGINE=InnoDB DEFAULT CHARSET=latin1;
248INSERT INTO `db1_1gb`.`orders` VALUES (4001,115,"O",95929.46,"1997-05-15","3-MEDIUM","Clerk#000000878",0,"detect. asymptotes sleep furio",2013,"detect. asymptotes sleep furio"),(4002,104,"O",76518.11,"1997-04-08","5-LOW","Clerk#000000097",0," regular braids are. furiously even patterns agains",2013," regular braids are. furiously even patterns agains"),(4003,112,"F",17603.01,"1993-01-27","1-URGENT","Clerk#000000177",0," blithe theodolites are slyly. slyly silent accounts toward",2013," blithe theodolites are slyly. slyly silent accounts toward"),(4004,70,"F",220715.14,"1993-05-07","3-MEDIUM","Clerk#000000273",0,"accounts among the blithely regular sentiments ",2013,"accounts among the blithely regular sentiments ");
249ALTER TABLE `db1_1gb`.`orders` ADD KEY `o_totalprice_index` (`O_TOTALPRICE`);
250ALTER TABLE `db1_1gb`.`orders` ADD KEY `o_orderdate_index` (`O_ORDERDATE`);
251ALTER TABLE `db1_1gb`.`orders` ADD KEY `o_comment_index` (`O_COMMENT`(10));
252CREATE TABLE `db1_1gb`.`part` (
253`P_partKEY` int(11) NOT NULL,
254`P_NAME` varchar(55) NOT NULL,
255`P_MFGR` char(25) NOT NULL,
256`P_BRAND` binary(16) NOT NULL,
257`P_TYPE` varbinary(128) NOT NULL,
258`P_SIZE` smallint(6) NOT NULL,
259`P_CONTAINER` char(10) NOT NULL,
260`P_RETAILPRICE` decimal(15,2) NOT NULL,
261`P_COMMENT` varchar(23) NOT NULL,
262`P_SUMMARY` tinyblob NOT NULL,
263PRIMARY KEY (`P_partKEY`)
264) ENGINE=InnoDB DEFAULT CHARSET=latin1;
265CREATE TABLE `db1_1gb`.`partsupp` (
266`PS_partKEY` int(11) NOT NULL,
267`PS_SUPPKEY` int(11) NOT NULL,
268`PS_AVAILQTY` int(11) NOT NULL,
269`PS_SUPPLYCOST` float NOT NULL,
270`PS_COMMENT` varchar(199) NOT NULL,
271PRIMARY KEY (`PS_partKEY`,`PS_SUPPKEY`)
272) ENGINE=InnoDB DEFAULT CHARSET=latin1;
273CREATE TABLE `db1_1gb`.`region` (
274`R_regionKEY` int(11) NOT NULL,
275`R_NAME` char(25) NOT NULL,
276`R_COMMENT` longtext,
277PRIMARY KEY (`R_regionKEY`)
278) ENGINE=InnoDB DEFAULT CHARSET=latin1;
279CREATE TABLE `db1_1gb`.`supplier` (
280`S_SUPPKEY` int(11) NOT NULL,
281`S_NAME` char(25) NOT NULL,
282`S_ADDRESS` varchar(40) NOT NULL,
283`S_nationKEY` int(11) NOT NULL,
284`S_PHONE` char(15) NOT NULL,
285`S_ACCTBAL` decimal(15,2) NOT NULL,
286`S_COMMENT` varchar(101) NOT NULL,
287`S_SUMMARY` blob NOT NULL,
288PRIMARY KEY (`S_SUPPKEY`)
289) ENGINE=InnoDB DEFAULT CHARSET=latin1;
290DROP DATABASE db1;
291DROP DATABASE db2;
292DROP DATABASE db1_1gb;
293DROP DATABASE db2;
294DROP DATABASE db3;
295DROP DATABASE db1_1gb;
296DROP DATABASE db1;
297DROP DATABASE db2;
298DROP DATABASE db3;
299DROP DATABASE db1_1gb;
300