Drizzled Public API Documentation

multi_column_primary_key.inc

00001 # 
00002 # Test that tables with multi-column primary keys
00003 # are handled properly in replication
00004 #
00005 
00006 --disable_warnings
00007 DROP TABLE IF EXISTS t1;
00008 --enable_warnings
00009 
00010 CREATE TABLE t1 (
00011   k1 INT NOT NULL
00012 , k2 INT NOT NULL
00013 , padding VARCHAR(200) NOT NULL
00014 , PRIMARY KEY (k1, k2)
00015 );
00016 
00017 INSERT INTO t1 VALUES (1, 1, "I love testing.");
00018 INSERT INTO t1 VALUES (2, 2, "I hate testing.");
00019 INSERT INTO t1 VALUES (2, 3, "I hate and love testing.");
00020 INSERT INTO t1 VALUES (3, 3, "I adore testing.");
00021 
00022 # Simple PK update on both columns
00023 UPDATE t1 SET padding= "XXX" WHERE k1= 1 AND k2= 1;
00024 
00025 # UPDATE all records in table matching first column
00026 # in primary key
00027 UPDATE t1 SET padding= "YYY" WHERE k1= 2;
00028 
00029 # UPDATE all records in table matching second column
00030 # in primary key
00031 UPDATE t1 SET padding= "ZZZ" WHERE k2= 3;
00032 
00033 # UPDATE all records in table
00034 UPDATE t1 SET padding= "AAA";
00035 
00036 DROP TABLE t1;