2
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
5
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
8
create table t1(n char(30));
9
set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
10
set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
12
set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def';
13
insert into t1 values (@i1), (@i2), (@i3), (@i4);
14
insert into t1 values (@r1), (@r2);
15
insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
16
insert into t1 values (@n1);
17
insert into t1 values (@n2);
18
insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
19
insert into t1 values (@a+(@b:=@a+1));
21
insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
23
insert into t1 values (@a),(@a);
24
select * from t1 where n = '<nonexistant>';
26
insert into t1 values (@a),(@a),(@a*5);
27
SELECT * FROM t1 ORDER BY n;
54
SELECT * FROM t1 ORDER BY n;
81
insert into t1 select * FROM (select @var1 union select @var2) AS t2;
84
DROP TABLE IF EXISTS t20;
85
DROP TABLE IF EXISTS t21;
86
DROP PROCEDURE IF EXISTS test.insert;
87
CREATE TABLE t20 (a VARCHAR(20));
88
CREATE TABLE t21 (a VARCHAR(20));
89
CREATE PROCEDURE test.insert()
93
INSERT INTO test.t20 VALUES ('SP_TRUE');
95
INSERT INTO test.t20 VALUES ('SP_FALSE');
98
CREATE TRIGGER test.insert_bi BEFORE INSERT
99
ON test.t20 FOR EACH ROW
103
INSERT INTO test.t21 VALUES ('TRIG_TRUE');
105
INSERT INTO test.t21 VALUES ('TRIG_FALSE');
112
On master: Check the tables for correct data
121
On slave: Check the tables for correct data and it matches master
132
DROP PROCEDURE test.insert;
133
DROP TABLE IF EXISTS t1;
134
DROP FUNCTION IF EXISTS test.square;
135
CREATE TABLE t1 (i INT);
136
CREATE FUNCTION test.square() RETURNS INTEGER DETERMINISTIC RETURN
139
INSERT INTO t1 VALUES (square());
141
INSERT INTO t1 VALUES (square());
143
INSERT INTO t1 VALUES (square());
145
INSERT INTO t1 VALUES (square());
147
INSERT INTO t1 VALUES (square());
148
On master: Retrieve the values from the table
156
On slave: Retrieve the values from the table and verify they are the same as on master
165
DROP FUNCTION test.square;
166
DROP TABLE IF EXISTS t1;
167
DROP FUNCTION IF EXISTS f1;
168
DROP FUNCTION IF EXISTS f2;
169
CREATE TABLE t1(a int);
170
CREATE FUNCTION f1() returns int deterministic BEGIN
173
CREATE FUNCTION f2() returns int deterministic BEGIN
182
INSERT INTO t1 values(f1());
185
INSERT INTO t1 values(f2());
186
On master: Retrieve the values from the table
191
On slave: Check the tables for correct data and it matches master
199
DROP TABLE IF EXISTS t1;
200
DROP TABLE IF EXISTS t2;
201
CREATE TABLE t1 (i int);
202
CREATE TABLE t2 (k int);
203
CREATE trigger t1_bi before INSERT on t1 for each row BEGIN
204
INSERT INTO t2 values (@a);
206
INSERT INTO t2 values (@a);
209
INSERT INTO t1 values (5);
210
On master: Check to see that data was inserted correctly in both tables
218
On slave: Check the tables for correct data and it matches master
227
create table t1(a int, b int);
228
prepare s1 from 'insert into t1 values (@x:=@x+1, ?)';
238
create table t1(a int);
239
insert into t1 values (1),(2);
240
prepare s1 from 'insert into t1 select a from t1 limit ?';
255
DROP FUNCTION IF EXISTS f1;
256
DROP FUNCTION IF EXISTS f2;
257
CREATE TABLE t1 (i INT);
258
CREATE FUNCTION f1() RETURNS INT RETURN @a;
260
FUNCTION f2() RETURNS INT BEGIN
261
INSERT INTO t1 VALUES (10 + @a);
268
On master: Check to see that data was inserted correctly
269
INSERT INTO t1 VALUES(f1());
274
On slave: Check the table for correct data and it matches master