github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/charset_gbk/data/test.sql (about)

     1  DROP DATABASE IF EXISTS `charset_gbk_test0`;
     2  
     3  CREATE DATABASE `charset_gbk_test0` CHARACTER SET utf8mb4;
     4  
     5  USE `charset_gbk_test0`;
     6  
     7  /* this is a test for columns which charset is gbk, with pk*/
     8  CREATE TABLE t0 (
     9  	id INT,
    10  	name varchar(128) CHARACTER SET gbk,
    11  	country char(32) CHARACTER SET gbk,
    12  	city varchar(64),
    13  	description text CHARACTER SET gbk,
    14  	image tinyblob,
    15  	PRIMARY KEY (id)
    16  ) ENGINE = InnoDB CHARSET = utf8mb4;
    17  
    18  INSERT INTO t0
    19  VALUES (1, '测试', "中国", "上海", "你好,世界"
    20  	, 0xC4E3BAC3CAC0BDE7);
    21  
    22  INSERT INTO t0
    23  VALUES (2, '部署', "美国", "纽约", "世界,你好"
    24  	, 0xCAC0BDE7C4E3BAC3);
    25  
    26  UPDATE t0
    27  SET name = '开发'
    28  WHERE name = '测试';
    29  
    30  DELETE FROM t0
    31  WHERE name = '部署';
    32  
    33  /* this is a test for table which charset is gbk, without pk but with uk */
    34  CREATE TABLE t1 (
    35  	id INT NOT NULL,
    36  	name varchar(128) CHARACTER SET gbk NOT NULL,
    37  	country char(32) CHARACTER SET gbk,
    38  	city varchar(64),
    39  	description text CHARACTER SET gbk,
    40  	image tinyblob,
    41  	UNIQUE KEY (id, name)
    42  ) ENGINE = InnoDB CHARSET = utf8mb4;
    43  
    44  INSERT INTO t1
    45  VALUES (1, '测试', "中国", "上海", "你好,世界"
    46  	, 0xC4E3BAC3CAC0BDE7);
    47  
    48  INSERT INTO t1
    49  VALUES (2, '部署', "美国", "纽约", "世界,你好"
    50  	, 0xCAC0BDE7C4E3BAC3);
    51  
    52  UPDATE t1
    53  SET name = '开发'
    54  WHERE name = '测试';
    55  
    56  DELETE FROM t1
    57  WHERE name = '部署';
    58  
    59  /* this is a test for table which charset is gbk*/
    60  CREATE TABLE t2 (
    61  	id INT,
    62  	name varchar(128),
    63  	country char(32),
    64  	city varchar(64),
    65  	description text,
    66  	image tinyblob,
    67  	PRIMARY KEY (id)
    68  ) ENGINE = InnoDB CHARSET = gbk;
    69  
    70  INSERT INTO t2
    71  VALUES (1, '测试', "中国", "上海", "你好,世界"
    72  	, 0xC4E3BAC3CAC0BDE7);
    73  
    74  INSERT INTO t2
    75  VALUES (2, '部署', "美国", "纽约", "世界,你好"
    76  	, 0xCAC0BDE7C4E3BAC3);
    77  
    78  UPDATE t2
    79  SET name = '开发'
    80  WHERE name = '测试';
    81  
    82  DELETE FROM t2
    83  WHERE name = '部署';
    84  
    85  /* this is a test for db which charset is gbk*/
    86  DROP DATABASE IF EXISTS `charset_gbk_test1`;
    87  
    88  CREATE DATABASE `charset_gbk_test1` CHARACTER SET GBK;
    89  
    90  USE `charset_gbk_test1`;
    91  
    92  CREATE TABLE t0 (
    93  	id INT,
    94  	name varchar(128),
    95  	country char(32),
    96  	city varchar(64),
    97  	description text,
    98  	image tinyblob,
    99  	PRIMARY KEY (id)
   100  ) ENGINE = InnoDB;
   101  
   102  INSERT INTO t0
   103  VALUES (1, '测试', "中国", "上海", "你好,世界"
   104  	, 0xC4E3BAC3CAC0BDE7);
   105  
   106  INSERT INTO t0
   107  VALUES (2, '部署', "美国", "纽约", "世界,你好"
   108  	, 0xCAC0BDE7C4E3BAC3);
   109  
   110  SELECT sleep(5);
   111  
   112  UPDATE t0
   113  SET name = '开发'
   114  WHERE name = '测试'
   115  	AND country = '中国'
   116  	AND description = '你好,世界';
   117  
   118  DELETE FROM t0
   119  WHERE name = '部署'
   120  	AND country = '美国'
   121  	AND description = '世界,你好';
   122  
   123  /* this is a DLL test for column */
   124  CREATE TABLE t1 (
   125  	id INT,
   126  	名称 varchar(128),
   127  	PRIMARY KEY (id)
   128  ) ENGINE = InnoDB;
   129  
   130  ALTER TABLE t1
   131  	ADD COLUMN 城市 char(32);
   132  
   133  ALTER TABLE t1
   134  	MODIFY COLUMN 城市 varchar(32);
   135  
   136  ALTER TABLE t1
   137  	DROP COLUMN 城市;
   138  
   139  /* this is a DDL test for table */
   140  CREATE TABLE 表2 (
   141  	id INT,
   142  	name varchar(128),
   143  	PRIMARY KEY (id)
   144  ) ENGINE = InnoDB;
   145  
   146  RENAME TABLE 表2 TO 表3;
   147  
   148  DROP TABLE 表3;
   149  
   150  /* this is a DDL test for database */
   151  DROP DATABASE IF EXISTS `测试库`;
   152  
   153  CREATE DATABASE `测试库` CHARACTER SET GBK;
   154  
   155  DROP DATABASE `测试库`;
   156  
   157  USE `test`;
   158  
   159  CREATE TABLE finish_mark (
   160  	id int PRIMARY KEY
   161  );