| 1 |
SET @transaction_isolation= @@global.transaction_isolation; |
| 2 |
SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 3 |
INSERT INTO cache_policies VALUES("cache_policy", "innodb_only", |
| 4 |
"innodb_only", "innodb_only", "innodb_only"); |
| 5 |
INSERT INTO config_options VALUES("separator", "|"); |
| 6 |
INSERT INTO containers VALUES ("desc_t1", "test", "t1", |
| 7 |
"c1", "c2,c21", "c3", "c4", "c5", "it1"); |
| 8 |
USE test; |
| 9 |
DROP TABLE IF EXISTS t1; |
| 10 |
DROP TABLE IF EXISTS t2; |
| 11 |
CREATE TABLE t1 (c1 VARCHAR(32), |
| 12 |
c2 VARCHAR(1024), |
| 13 |
c21 VARCHAR(1024), |
| 14 |
c3 INT, c4 BIGINT UNSIGNED, c5 INT) |
| 15 |
ENGINE = INNODB; |
| 16 |
CREATE UNIQUE INDEX it1 ON t1 (c1); |
| 17 |
CREATE TABLE t2 (c1 VARCHAR(32), |
| 18 |
c11 VARCHAR(32), |
| 19 |
c2 VARCHAR(255), |
| 20 |
c21 VARCHAR(255), |
| 21 |
c3 INT, c4 BIGINT UNSIGNED, c5 INT, primary key(c1), |
| 22 |
CONSTRAINT ft2 FOREIGN KEY (c11) REFERENCES t1(c1)) |
| 23 |
ENGINE = INNODB; |
| 24 |
INSERT INTO t1 VALUES ('Dd', 'Hessen', 'M', 0, 0, 0); |
| 25 |
INSERT INTO t1 VALUES ('Bb', 'Brandenburg', 'M', 0, 0, 0); |
| 26 |
INSERT INTO t1 VALUES ('Cc', 'Lausitz', 'S', 0, 0 ,0); |
| 27 |
INSERT INTO t1 VALUES ('Hh', 'Schleswig-Holstein', 'S', 0, 0, 0); |
| 28 |
INSERT INTO t2 VALUES ('D','Dd', 'Darmstadt', 'City', 0, 0, 0); |
| 29 |
INSERT INTO t2 VALUES ('B','Bb', 'Berlin', 'Mitte', 0, 0, 0); |
| 30 |
INSERT INTO t2 VALUES ('C','Cc', 'Cottbus', 'West', 0, 0 ,0); |
| 31 |
INSERT INTO t2 VALUES ('H','Hh', 'Hamburg', 'Norderstedt', 0, 0, 0); |
| 32 |
INSTALL PLUGIN daemon_memcached SONAME 'libmemcached.so'; |
| 33 |
Warnings: |
| 34 |
Warning 1681 'InnoDB Memcached Plugin' is deprecated and will be removed in a future release. |
| 35 |
SELECT c1,c2,c21 FROM t1; |
| 36 |
c1 c2 c21 |
| 37 |
Bb Brandenburg M |
| 38 |
Cc Lausitz S |
| 39 |
Dd Hessen M |
| 40 |
Hh Schleswig-Holstein S |
| 41 |
Here are the memcached results with D,B,H,C: |
| 42 |
Hessen|M |
| 43 |
Brandenburg|M |
| 44 |
Schleswig-Holstein|S |
| 45 |
Lausitz|S |
| 46 |
SELECT t1.c1,t1.c2,t1.c21,t2.c2,t2.c21 FROM t1,t2 WHERE t2.c11=t1.c1; |
| 47 |
c1 c2 c21 c2 c21 |
| 48 |
Bb Brandenburg M Berlin Mitte |
| 49 |
Cc Lausitz S Cottbus West |
| 50 |
Dd Hessen M Darmstadt City |
| 51 |
Hh Schleswig-Holstein S Hamburg Norderstedt |
| 52 |
Here are the memcached results after set: |
| 53 |
Hessen|O |
| 54 |
SELECT t1.c1,t1.c2,t1.c21,t2.c2,t2.c21 FROM t1,t2 WHERE t2.c11=t1.c1; |
| 55 |
c1 c2 c21 c2 c21 |
| 56 |
Bb Brandenburg M Berlin Mitte |
| 57 |
Cc Lausitz S Cottbus West |
| 58 |
Dd Hessen M Darmstadt City |
| 59 |
Hh Schleswig-Holstein S Hamburg Norderstedt |
| 60 |
Here are the memcached results after add: |
| 61 |
Mecklenburg|V |
| 62 |
SELECT t1.c1,t1.c2,t1.c21,t2.c2,t2.c21 FROM t1,t2 WHERE t2.c11=t1.c1; |
| 63 |
c1 c2 c21 c2 c21 |
| 64 |
Bb Brandenburg M Berlin Mitte |
| 65 |
Cc Lausitz S Cottbus West |
| 66 |
Dd Hessen M Darmstadt City |
| 67 |
Hh Schleswig-Holstein S Hamburg Norderstedt |
| 68 |
Here are the memcached results after replace: |
| 69 |
Mecklenburg-Vorpommern|V |
| 70 |
SELECT t1.c1,t1.c2,t1.c21,t2.c2,t2.c21 FROM t1,t2 WHERE t2.c11=t1.c1; |
| 71 |
c1 c2 c21 c2 c21 |
| 72 |
Bb Brandenburg M Berlin Mitte |
| 73 |
Cc Lausitz S Cottbus West |
| 74 |
Dd Hessen M Darmstadt City |
| 75 |
Hh Schleswig-Holstein S Hamburg Norderstedt |
| 76 |
Here are the memcached results after delete: |
| 77 |
SELECT t1.c1,t1.c2,t1.c21,t2.c2,t2.c21 FROM t1,t2 WHERE t2.c11=t1.c1; |
| 78 |
c1 c2 c21 c2 c21 |
| 79 |
Bb Brandenburg M Berlin Mitte |
| 80 |
Cc Lausitz S Cottbus West |
| 81 |
Dd Hessen M Darmstadt City |
| 82 |
Hh Schleswig-Holstein S Hamburg Norderstedt |
| 83 |
INSERT INTO t2 VALUES ('E','Ff', 'Essen','Ost', 0, 0, 0); |
| 84 |
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `ft2` FOREIGN KEY (`c11`) REFERENCES `t1` (`c1`)) |
| 85 |
Here are the memcached results after add Frankfurt|Airport: |
| 86 |
Mecklenburg-Vorpommern|A |
| 87 |
INSERT INTO t2 VALUES ('E','Ff', 'Essen','Ost', 0, 0, 0); |
| 88 |
SELECT t1.c1,t1.c2,t1.c21,t2.c2,t2.c21 FROM t1,t2 WHERE t2.c11=t1.c1; |
| 89 |
c1 c2 c21 c2 c21 |
| 90 |
Bb Brandenburg M Berlin Mitte |
| 91 |
Cc Lausitz S Cottbus West |
| 92 |
Dd Hessen M Darmstadt City |
| 93 |
Ff Mecklenburg-Vorpommern A Essen Ost |
| 94 |
Hh Schleswig-Holstein S Hamburg Norderstedt |
| 95 |
DROP TABLE test.t2; |
| 96 |
DROP TABLE test.t1; |
| 97 |
UNINSTALL PLUGIN daemon_memcached; |
| 98 |
DROP DATABASE innodb_memcache; |
| 99 |
SET @@global.transaction_isolation= @transaction_isolation; |