2
# Simple test of the transaction log for testing REPLACE command
4
# We create a table then fill it with a few records and then
5
# issue a few REPLACE statements on it.
9
DROP TABLE IF EXISTS t1, t2;
13
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
14
, padding VARCHAR(200) NOT NULL
17
INSERT INTO t1 VALUES (1, "I love testing.");
18
INSERT INTO t1 VALUES (2, "I hate testing.");
20
# This will actually execute an UPDATE for InnoDB,
21
# as this is an optimized scenario that can have the
22
# REPLACE INTO converted into an INSERT ... ON DUPLICATE
25
REPLACE INTO t1 VALUE (2, "I love testing.");
30
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
31
, padding VARCHAR(200) NOT NULL
34
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
36
, CONSTRAINT fk_t1 FOREIGN KEY (fk_id) REFERENCES t1 (id) ON DELETE CASCADE
39
INSERT INTO t1 VALUES (1, "I love testing.");
40
INSERT INTO t1 VALUES (2, "I hate testing.");
42
# Should delete original and insert a new one
43
# with a different "padding" column value...
45
REPLACE INTO t1 VALUE (2, "I love testing.");