improved sql parser.

This commit is contained in:
wenshao
2017-05-21 11:28:30 +08:00
parent 869c45695b
commit 8b51ecf021
90 changed files with 1135 additions and 857 deletions
@@ -31,8 +31,8 @@ public class MappingTest_createTable_2 extends TestCase {
public void test_mapping_createTable_mysql() throws Exception {
String result = SQLUtils.refactor(sql, JdbcConstants.MYSQL, mapping);
assertEquals("CREATE TABLE database_target.table_target (\n" +
"\tsource_key int, \n" +
"\tsource_value varchar(32), \n" +
"\tsource_key int,\n" +
"\tsource_value varchar(32),\n" +
"\tPRIMARY KEY (source_key)\n" +
")", result);
}
@@ -26,8 +26,8 @@ public class MySqlFormatTest extends TestCase {
public void test_0() throws Exception {
String text = "CREATE TABLE customer (a INT, b CHAR (20), INDEX (a));";
Assert.assertEquals("CREATE TABLE customer (\n" + //
"\ta INT, \n" + //
"\tb CHAR(20), \n" + //
"\ta INT,\n" + //
"\tb CHAR(20),\n" + //
"\tINDEX(a)\n" + //
");", SQLUtils.format(text, JdbcUtils.MYSQL));
}
@@ -41,8 +41,8 @@ public class MySqlHintStatementTest extends TestCase {
+ "\n/*!40101 SET character_set_client = utf8 */;"
+ "\n"
+ "\nCREATE TABLE `item_similarity` ("
+ "\n\t`id` bigint(20) UNSIGNED NOT NULL, "
+ "\n\t`sellerId` bigint(20) DEFAULT NULL, "
+ "\n\t`id` bigint(20) UNSIGNED NOT NULL,"
+ "\n\t`sellerId` bigint(20) DEFAULT NULL,"
+ "\n\tPRIMARY KEY (`id`)"
+ "\n) ENGINE = InnoDB CHARSET = utf8;"
+ "\n"
@@ -48,12 +48,12 @@ public class MySqlCeateTableTest34 extends TestCase {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE \"item_extra\" (\n" +
"\t\"id\" int(10) UNSIGNED NOT NULL AUTO_INCREMENT, \n" +
"\t\"item_id\" int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '商品id', \n" +
"\t\"type\" tinyint(4) UNSIGNED NOT NULL DEFAULT '0' COMMENT '扩展属性类型,0:虚拟商品', \n" +
"\t\"attr_key\" varchar(50) NOT NULL COMMENT '扩展属性key', \n" +
"\t\"attr_value\" varchar(500) NOT NULL COMMENT '扩展属性value', \n" +
"\tPRIMARY KEY ('id'), \n" +
"\t\"id\" int(10) UNSIGNED NOT NULL AUTO_INCREMENT,\n" +
"\t\"item_id\" int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '商品id',\n" +
"\t\"type\" tinyint(4) UNSIGNED NOT NULL DEFAULT '0' COMMENT '扩展属性类型,0:虚拟商品',\n" +
"\t\"attr_key\" varchar(50) NOT NULL COMMENT '扩展属性key',\n" +
"\t\"attr_value\" varchar(500) NOT NULL COMMENT '扩展属性value',\n" +
"\tPRIMARY KEY ('id'),\n" +
"\tKEY \"idx_item_type_kv\" ('item_id', 'type', 'attr_key', 'attr_value'(191))\n" +
")", output);
}
@@ -45,24 +45,24 @@ public class MySqlCreateTableTest14 extends MysqlTest {
SQLStatement stmt = statementList.get(0);
Assert.assertEquals("CREATE TABLE `OptionList` ("
+ "\n\t`ID` int(11) NOT NULL AUTO_INCREMENT, "
+ "\n\t`OptionID` int(11) DEFAULT NULL COMMENT '选项ID', "
+ "\n\t`QuizID` int(11) DEFAULT NULL COMMENT '竞猜题目ID', "
+ "\n\t`OptionName` varchar(500) DEFAULT NULL COMMENT '选项名称', "
+ "\n\t`OptionCount` int(11) DEFAULT NULL COMMENT '选择的人数', "
+ "\n\tPRIMARY KEY (`ID`), "
+ "\n\tKEY `quizId` USING BTREE (`QuizID`), "
+ "\n\t`ID` int(11) NOT NULL AUTO_INCREMENT,"
+ "\n\t`OptionID` int(11) DEFAULT NULL COMMENT '选项ID',"
+ "\n\t`QuizID` int(11) DEFAULT NULL COMMENT '竞猜题目ID',"
+ "\n\t`OptionName` varchar(500) DEFAULT NULL COMMENT '选项名称',"
+ "\n\t`OptionCount` int(11) DEFAULT NULL COMMENT '选择的人数',"
+ "\n\tPRIMARY KEY (`ID`),"
+ "\n\tKEY `quizId` USING BTREE (`QuizID`),"
+ "\n\tKEY `optionId` USING BTREE (`OptionID`)"
+ "\n) ENGINE = InnoDB CHARSET = gbk COMMENT = ''", //
SQLUtils.toMySqlString(stmt));
Assert.assertEquals("create table `OptionList` ("
+ "\n\t`ID` int(11) not null auto_increment, "
+ "\n\t`OptionID` int(11) default null comment '选项ID', "
+ "\n\t`QuizID` int(11) default null comment '竞猜题目ID', "
+ "\n\t`OptionName` varchar(500) default null comment '选项名称', "
+ "\n\t`OptionCount` int(11) default null comment '选择的人数', "
+ "\n\tprimary key (`ID`), "
+ "\n\tkey `quizId` using BTREE (`QuizID`), "
+ "\n\t`ID` int(11) not null auto_increment,"
+ "\n\t`OptionID` int(11) default null comment '选项ID',"
+ "\n\t`QuizID` int(11) default null comment '竞猜题目ID',"
+ "\n\t`OptionName` varchar(500) default null comment '选项名称',"
+ "\n\t`OptionCount` int(11) default null comment '选择的人数',"
+ "\n\tprimary key (`ID`),"
+ "\n\tkey `quizId` using BTREE (`QuizID`),"
+ "\n\tkey `optionId` using BTREE (`OptionID`)"
+ "\n) engine = InnoDB charset = gbk comment = ''", //
SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION));
@@ -57,7 +57,7 @@ public class MySqlCreateTableTest22 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t1 (" + //
"\n\tc1 INT STORAGE DISK, " + //
"\n\tc1 INT STORAGE DISK," + //
"\n\tc2 INT STORAGE MEMORY" + //
"\n) TABLESPACE ts_1 ENGINE = NDB", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest23 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) ENGINE = MEMORY", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest24 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) AVG_ROW_LENGTH = 1024", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest25 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) AVG_ROW_LENGTH = 1024", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest26 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) MAX_ROWS = 1024", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest27 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) MAX_ROWS = 1024", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest28 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) MIN_ROWS = 1024", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest29 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE user (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) MIN_ROWS = 1024", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest30 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) DELAY_KEY_WRITE = 0", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest31 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) DELAY_KEY_WRITE = 1", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest32 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) DATA DIRECTORY = 'aaa'", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest33 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) CONNECTION = 'aaa'", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest34 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) CHECKSUM = 1", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest35 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) AUTO_INCREMENT = 1", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest36 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) STATS_AUTO_RECALC = 1", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest37 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) STATS_AUTO_RECALC = DEFAULT", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest38 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) STATS_PERSISTENT = DEFAULT", output);
@@ -56,7 +56,7 @@ public class MySqlCreateTableTest39 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) STATS_PERSISTENT = 1", output);
@@ -55,7 +55,7 @@ public class MySqlCreateTableTest40 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t1 (" + //
"\n\tcol1 INT, " + //
"\n\tcol1 INT," + //
"\n\tcol2 CHAR(5)" + //
"\n)"
+ "\nPARTITION BY HASH (col1)", output);
@@ -56,8 +56,8 @@ public class MySqlCreateTableTest41 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE tk (" + //
"\n\tcol1 INT, " + //
"\n\tcol2 CHAR(5), " + //
"\n\tcol1 INT," + //
"\n\tcol2 CHAR(5)," + //
"\n\tcol3 DATE" + //
"\n)"
+ "\nPARTITION BY LINEAR KEY (col3) PARTITIONS 5", output);
@@ -63,7 +63,7 @@ public class MySqlCreateTableTest42 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE rc (" + //
"\n\ta INT NOT NULL, " + //
"\n\ta INT NOT NULL," + //
"\n\tb INT NOT NULL" + //
"\n)"
+ "\nPARTITION BY RANGE COLUMNS (a, b)"
@@ -63,7 +63,7 @@ public class MySqlCreateTableTest43 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE client_firms (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tname VARCHAR(35)" + //
"\n)"
+ "\nPARTITION BY LIST (id)"
@@ -63,7 +63,7 @@ public class MySqlCreateTableTest44 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lc (" + //
"\n\ta INT NULL, " + //
"\n\ta INT NULL," + //
"\n\tb INT NULL" + //
"\n)" + //
"\nPARTITION BY LIST COLUMNS (a, b)"
@@ -69,8 +69,8 @@ public class MySqlCreateTableTest45 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE th (" + //
"\n\tid INT, " + //
"\n\tname VARCHAR(30), " + //
"\n\tid INT," + //
"\n\tname VARCHAR(30)," + //
"\n\tadate DATE" + //
"\n)" + //
"\nPARTITION BY LIST (YEAR(adate))" + //
@@ -50,7 +50,7 @@ public class MySqlCreateTableTest46 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE lookup (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tINDEX USING BTREE(id)" + //
"\n) STATS_PERSISTENT = 1", output);
@@ -54,11 +54,11 @@ public class MySqlCreateTableTest47 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE issuestatus ("//
+ "\n\tID VARCHAR(60) NOT NULL, "//
+ "\n\tSEQUENCE DECIMAL(18, 0), "//
+ "\n\tpname VARCHAR(60), "//
+ "\n\tDESCRIPTION TEXT, "//
+ "\n\tICONURL VARCHAR(255), "//
+ "\n\tID VARCHAR(60) NOT NULL,"//
+ "\n\tSEQUENCE DECIMAL(18, 0),"//
+ "\n\tpname VARCHAR(60),"//
+ "\n\tDESCRIPTION TEXT,"//
+ "\n\tICONURL VARCHAR(255),"//
+ "\n\tCONSTRAINT PK_issuestatus PRIMARY KEY (ID)"//
+ "\n)", output);
@@ -55,11 +55,11 @@ public class MySqlCreateTableTest48 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE AO_E8B6CC_REPO_TO_CHANGESET ("//
+ "\n\tCHANGESET_ID INTEGER, "//
+ "\n\tID INTEGER NOT NULL AUTO_INCREMENT, "//
+ "\n\tREPOSITORY_ID INTEGER, "//
+ "\n\tCONSTRAINT fk_ao_e8b6cc_repo_to_changeset_repository_id FOREIGN KEY (REPOSITORY_ID) REFERENCES AO_E8B6CC_REPOSITORY_MAPPING (ID), "//
+ "\n\tCONSTRAINT fk_ao_e8b6cc_repo_to_changeset_changeset_id FOREIGN KEY (CHANGESET_ID) REFERENCES AO_E8B6CC_CHANGESET_MAPPING (ID), "//
+ "\n\tCHANGESET_ID INTEGER,"//
+ "\n\tID INTEGER NOT NULL AUTO_INCREMENT,"//
+ "\n\tREPOSITORY_ID INTEGER,"//
+ "\n\tCONSTRAINT fk_ao_e8b6cc_repo_to_changeset_repository_id FOREIGN KEY (REPOSITORY_ID) REFERENCES AO_E8B6CC_REPOSITORY_MAPPING (ID),"//
+ "\n\tCONSTRAINT fk_ao_e8b6cc_repo_to_changeset_changeset_id FOREIGN KEY (CHANGESET_ID) REFERENCES AO_E8B6CC_CHANGESET_MAPPING (ID),"//
+ "\n\tPRIMARY KEY (ID)"//
+ "\n) ENGINE = InnoDB",//
output);
@@ -56,12 +56,12 @@ public class MySqlCreateTableTest49 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE tauth (" //
+ "\n\tcid varchar(36) NOT NULL UNIQUE, "//
+ "\n\tcdesc varchar(200), "//
+ "\n\tcname varchar(100) NOT NULL, "//
+ "\n\tcseq decimal(22, 0), "//
+ "\n\tcurl varchar(200), "//
+ "\n\tcpid varchar(36), "//
+ "\n\tcid varchar(36) NOT NULL UNIQUE,"//
+ "\n\tcdesc varchar(200),"//
+ "\n\tcname varchar(100) NOT NULL,"//
+ "\n\tcseq decimal(22, 0),"//
+ "\n\tcurl varchar(200),"//
+ "\n\tcpid varchar(36),"//
+ "\n\tPRIMARY KEY (cid)"//
+ "\n)",//
output);
@@ -51,7 +51,7 @@ public class MySqlCreateTableTest50 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `test`.`a` (" //
+ "\n\t`ida` INT NOT NULL COMMENT 'aaa', "//
+ "\n\t`ida` INT NOT NULL COMMENT 'aaa',"//
+ "\n\tPRIMARY KEY (`ida`)"//
+ "\n) COMMENT = 'bb'",//
output);
@@ -52,7 +52,7 @@ public class MySqlCreateTableTest51 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
// System.out.println(output);
Assert.assertEquals("CREATE TABLE `test` (" //
+ "\n\t`Id` int(11) NOT NULL, "//
+ "\n\t`Id` int(11) NOT NULL,"//
+ "\n\t`text` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL"//
+ "\n) ENGINE = InnoDB CHARSET = gbk",//
output);
@@ -56,13 +56,13 @@ public class MySqlCreateTableTest52 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `ins_ebay_auth` ("//
+"\n\t`auth_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键id', " //
+"\n\t`usr_id` int(10) NOT NULL COMMENT '外键,用户表', "//
+"\n\t`status` char(1) COLLATE utf8_bin NOT NULL COMMENT '状态 0.有效?1.无效', "//
+"\n\t`ebay_token` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'eBay授权码', "//
+"\n\t`ebay_name` varchar(50) NOT NULL COMMENT 'eBay唯一名', "//
+"\n\t`create_time` datetime NOT NULL COMMENT '授权时间', "//
+"\n\t`invalid_time` datetime NOT NULL COMMENT '授权失效时间', "//
+"\n\t`auth_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键id'," //
+"\n\t`usr_id` int(10) NOT NULL COMMENT '外键,用户表',"//
+"\n\t`status` char(1) COLLATE utf8_bin NOT NULL COMMENT '状态 0.有效?1.无效',"//
+"\n\t`ebay_token` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'eBay授权码',"//
+"\n\t`ebay_name` varchar(50) NOT NULL COMMENT 'eBay唯一名',"//
+"\n\t`create_time` datetime NOT NULL COMMENT '授权时间',"//
+"\n\t`invalid_time` datetime NOT NULL COMMENT '授权失效时间',"//
+"\n\tPRIMARY KEY (`auth_id`)"
+"\n) ENGINE = InnoDB CHARSET = utf8 COLLATE utf8_bin COMMENT = 'INS_EBAY_AUTH'", output);
}
@@ -58,13 +58,13 @@ public class MySqlCreateTableTest53 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `ins_ebay_auth` ("//
+"\n\t`auth_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键id', " //
+"\n\t`usr_id` int(10) NOT NULL COMMENT '外键,用户表', "//
+"\n\t`status` char(1) COLLATE utf8_bin NOT NULL COMMENT '状态 0.有效?1.无效', "//
+"\n\t`ebay_token` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'eBay授权码', "//
+"\n\t`ebay_name` varchar(50) NOT NULL COMMENT 'eBay唯一名', "//
+"\n\t`create_time` datetime NOT NULL COMMENT '授权时间', "//
+"\n\t`invalid_time` datetime NOT NULL COMMENT '授权失效时间', "//
+"\n\t`auth_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键id'," //
+"\n\t`usr_id` int(10) NOT NULL COMMENT '外键,用户表',"//
+"\n\t`status` char(1) COLLATE utf8_bin NOT NULL COMMENT '状态 0.有效?1.无效',"//
+"\n\t`ebay_token` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'eBay授权码',"//
+"\n\t`ebay_name` varchar(50) NOT NULL COMMENT 'eBay唯一名',"//
+"\n\t`create_time` datetime NOT NULL COMMENT '授权时间',"//
+"\n\t`invalid_time` datetime NOT NULL COMMENT '授权失效时间',"//
+"\n\tPRIMARY KEY USING BTREE (`auth_id`)"
+"\n) ENGINE = InnoDB CHARSET = utf8 COLLATE utf8_bin COMMENT = 'INS_EBAY_AUTH'", output);
}
@@ -100,14 +100,14 @@ public class MySqlCreateTableTest53 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `ins_ebay_auth` ("//
+"\n\t`auth_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键id', " //
+"\n\t`usr_id` int(10) NOT NULL COMMENT '外键,用户表', "//
+"\n\t`status` char(1) COLLATE utf8_bin NOT NULL COMMENT '状态 0.有效?1.无效', "//
+"\n\t`ebay_token` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'eBay授权码', "//
+"\n\t`ebay_name` varchar(50) NOT NULL COMMENT 'eBay唯一名', "//
+"\n\t`create_time` datetime NOT NULL COMMENT '授权时间', "//
+"\n\t`invalid_time` datetime NOT NULL COMMENT '授权失效时间', "//
+"\n\tPRIMARY KEY USING BTREE (`auth_id`), "
+"\n\t`auth_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键id'," //
+"\n\t`usr_id` int(10) NOT NULL COMMENT '外键,用户表',"//
+"\n\t`status` char(1) COLLATE utf8_bin NOT NULL COMMENT '状态 0.有效?1.无效',"//
+"\n\t`ebay_token` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'eBay授权码',"//
+"\n\t`ebay_name` varchar(50) NOT NULL COMMENT 'eBay唯一名',"//
+"\n\t`create_time` datetime NOT NULL COMMENT '授权时间',"//
+"\n\t`invalid_time` datetime NOT NULL COMMENT '授权失效时间',"//
+"\n\tPRIMARY KEY USING BTREE (`auth_id`),"
+"\n\tINDEX `ind_usr_id` USING BTREE(`usr_id`)"
+"\n) ENGINE = InnoDB CHARSET = utf8 COLLATE utf8_bin COMMENT = 'INS_EBAY_AUTH'", output);
}
@@ -143,14 +143,14 @@ public class MySqlCreateTableTest53 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `ins_ebay_auth` ("//
+"\n\t`auth_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键id', " //
+"\n\t`usr_id` int(10) NOT NULL COMMENT '外键,用户表', "//
+"\n\t`status` char(1) COLLATE utf8_bin NOT NULL COMMENT '状态 0.有效?1.无效', "//
+"\n\t`ebay_token` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'eBay授权码', "//
+"\n\t`ebay_name` varchar(50) NOT NULL COMMENT 'eBay唯一名', "//
+"\n\t`create_time` datetime NOT NULL COMMENT '授权时间', "//
+"\n\t`invalid_time` datetime NOT NULL COMMENT '授权失效时间', "//
+"\n\tPRIMARY KEY USING BTREE (`auth_id`), "
+"\n\t`auth_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键id'," //
+"\n\t`usr_id` int(10) NOT NULL COMMENT '外键,用户表',"//
+"\n\t`status` char(1) COLLATE utf8_bin NOT NULL COMMENT '状态 0.有效?1.无效',"//
+"\n\t`ebay_token` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'eBay授权码',"//
+"\n\t`ebay_name` varchar(50) NOT NULL COMMENT 'eBay唯一名',"//
+"\n\t`create_time` datetime NOT NULL COMMENT '授权时间',"//
+"\n\t`invalid_time` datetime NOT NULL COMMENT '授权失效时间',"//
+"\n\tPRIMARY KEY USING BTREE (`auth_id`),"
+"\n\tKEY `ind_usr_id` USING BTREE (`usr_id`)"
+"\n) ENGINE = InnoDB CHARSET = utf8 COLLATE utf8_bin COMMENT = 'INS_EBAY_AUTH'", output);
}
@@ -45,7 +45,7 @@ public class MySqlCreateTableTest54 extends MysqlTest {
Assert.assertEquals(0, visitor.getConditions().size());
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t1 (" + "\n\tyear YEAR(4), " + "\n\tmonth INT(2) UNSIGNED ZEROFILL, "
Assert.assertEquals("CREATE TABLE t1 (" + "\n\tyear YEAR(4)," + "\n\tmonth INT(2) UNSIGNED ZEROFILL,"
+ "\n\tday INT(2) UNSIGNED ZEROFILL" + "\n)", output);
}
@@ -99,64 +99,64 @@ public class MySqlCreateTableTest54 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `t_activity_node` ("
+ "\n\t`id` bigint(20) NOT NULL, "
+ "\n\t`sellerId` bigint(20) DEFAULT NULL, "
+ "\n\t`canvas_id` bigint(20) NOT NULL COMMENT '画布ID', "
+ "\n\t`view_node_id` bigint(20) NOT NULL COMMENT '对应显示的节点id', "
+ "\n\t`activity_type` int(11) NOT NULL COMMENT '活动类型', "
+ "\n\t`node_type` int(11) NOT NULL COMMENT '节点类型', "
+ "\n\t`node_title` varchar(200) NOT NULL COMMENT '节点标题', "
+ "\n\t`status` int(11) NOT NULL DEFAULT '0' COMMENT '页面的显示状态', "
+ "\n\t`update_status` int(11) DEFAULT NULL COMMENT '节点创建后的修改状态', "
+ "\n\t`execute_status` int(11) DEFAULT NULL COMMENT '节点当前的执行状态', "
+ "\n\t`start_time` datetime DEFAULT NULL COMMENT '该节点活动的开始时间', "
+ "\n\t`end_time` datetime DEFAULT NULL COMMENT '该节点活动的结束时间', "
+ "\n\t`activity_start_time` datetime DEFAULT NULL COMMENT '营销活动的开始时间', "
+ "\n\t`activity_end_time` datetime DEFAULT NULL COMMENT '营销活动的结束时间', "
+ "\n\t`report_start_time` datetime DEFAULT NULL COMMENT '该节点活动效果报告的开始时间', "
+ "\n\t`report_end_time` datetime DEFAULT NULL COMMENT '该节点活动效果报告的结束时间', "
+ "\n\t`cron_rule` varchar(100) DEFAULT NULL COMMENT '周期性营销的时间表达式', "
+ "\n\t`split_rule` varchar(1000) DEFAULT NULL COMMENT '节点拆分规则', "
+ "\n\t`search_json` varchar(5000) DEFAULT NULL COMMENT '索引查找的条件字符串', "
+ "\n\t`filter_json` varchar(1000) DEFAULT NULL COMMENT '各种过滤条件的设置', "
+ "\n\t`buyer_count` int(11) DEFAULT NULL COMMENT '营销的会员数量', "
+ "\n\t`gmt_modified` datetime NOT NULL COMMENT '活动最后修改时间', "
+ "\n\t`gmt_create` datetime NOT NULL COMMENT '活动创建时间', "
+ "\n\tPRIMARY KEY (`id`), "
+ "\n\tKEY `canvas_id` (`canvas_id`), "
+ "\n\tKEY `sid_ty_time` (`sellerId`, `node_type`, `start_time`), "
+ "\n\t`id` bigint(20) NOT NULL,"
+ "\n\t`sellerId` bigint(20) DEFAULT NULL,"
+ "\n\t`canvas_id` bigint(20) NOT NULL COMMENT '画布ID',"
+ "\n\t`view_node_id` bigint(20) NOT NULL COMMENT '对应显示的节点id',"
+ "\n\t`activity_type` int(11) NOT NULL COMMENT '活动类型',"
+ "\n\t`node_type` int(11) NOT NULL COMMENT '节点类型',"
+ "\n\t`node_title` varchar(200) NOT NULL COMMENT '节点标题',"
+ "\n\t`status` int(11) NOT NULL DEFAULT '0' COMMENT '页面的显示状态',"
+ "\n\t`update_status` int(11) DEFAULT NULL COMMENT '节点创建后的修改状态',"
+ "\n\t`execute_status` int(11) DEFAULT NULL COMMENT '节点当前的执行状态',"
+ "\n\t`start_time` datetime DEFAULT NULL COMMENT '该节点活动的开始时间',"
+ "\n\t`end_time` datetime DEFAULT NULL COMMENT '该节点活动的结束时间',"
+ "\n\t`activity_start_time` datetime DEFAULT NULL COMMENT '营销活动的开始时间',"
+ "\n\t`activity_end_time` datetime DEFAULT NULL COMMENT '营销活动的结束时间',"
+ "\n\t`report_start_time` datetime DEFAULT NULL COMMENT '该节点活动效果报告的开始时间',"
+ "\n\t`report_end_time` datetime DEFAULT NULL COMMENT '该节点活动效果报告的结束时间',"
+ "\n\t`cron_rule` varchar(100) DEFAULT NULL COMMENT '周期性营销的时间表达式',"
+ "\n\t`split_rule` varchar(1000) DEFAULT NULL COMMENT '节点拆分规则',"
+ "\n\t`search_json` varchar(5000) DEFAULT NULL COMMENT '索引查找的条件字符串',"
+ "\n\t`filter_json` varchar(1000) DEFAULT NULL COMMENT '各种过滤条件的设置',"
+ "\n\t`buyer_count` int(11) DEFAULT NULL COMMENT '营销的会员数量',"
+ "\n\t`gmt_modified` datetime NOT NULL COMMENT '活动最后修改时间',"
+ "\n\t`gmt_create` datetime NOT NULL COMMENT '活动创建时间',"
+ "\n\tPRIMARY KEY (`id`),"
+ "\n\tKEY `canvas_id` (`canvas_id`),"
+ "\n\tKEY `sid_ty_time` (`sellerId`, `node_type`, `start_time`),"
+ "\n\tCONSTRAINT `t_activity_node_ibfk_1` FOREIGN KEY (`canvas_id`) REFERENCES `t_activity_canvas` (`id`) ON DELETE CASCADE ON UPDATE CASCADE"
+ "\n) ENGINE = InnoDB CHARSET = utf8", output);
}
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table `t_activity_node` ("
+ "\n\t`id` bigint(20) not null, "
+ "\n\t`sellerId` bigint(20) default null, "
+ "\n\t`canvas_id` bigint(20) not null comment '画布ID', "
+ "\n\t`view_node_id` bigint(20) not null comment '对应显示的节点id', "
+ "\n\t`activity_type` int(11) not null comment '活动类型', "
+ "\n\t`node_type` int(11) not null comment '节点类型', "
+ "\n\t`node_title` varchar(200) not null comment '节点标题', "
+ "\n\t`status` int(11) not null default '0' comment '页面的显示状态', "
+ "\n\t`update_status` int(11) default null comment '节点创建后的修改状态', "
+ "\n\t`execute_status` int(11) default null comment '节点当前的执行状态', "
+ "\n\t`start_time` datetime default null comment '该节点活动的开始时间', "
+ "\n\t`end_time` datetime default null comment '该节点活动的结束时间', "
+ "\n\t`activity_start_time` datetime default null comment '营销活动的开始时间', "
+ "\n\t`activity_end_time` datetime default null comment '营销活动的结束时间', "
+ "\n\t`report_start_time` datetime default null comment '该节点活动效果报告的开始时间', "
+ "\n\t`report_end_time` datetime default null comment '该节点活动效果报告的结束时间', "
+ "\n\t`cron_rule` varchar(100) default null comment '周期性营销的时间表达式', "
+ "\n\t`split_rule` varchar(1000) default null comment '节点拆分规则', "
+ "\n\t`search_json` varchar(5000) default null comment '索引查找的条件字符串', "
+ "\n\t`filter_json` varchar(1000) default null comment '各种过滤条件的设置', "
+ "\n\t`buyer_count` int(11) default null comment '营销的会员数量', "
+ "\n\t`gmt_modified` datetime not null comment '活动最后修改时间', "
+ "\n\t`gmt_create` datetime not null comment '活动创建时间', "
+ "\n\tprimary key (`id`), "
+ "\n\tkey `canvas_id` (`canvas_id`), "
+ "\n\tkey `sid_ty_time` (`sellerId`, `node_type`, `start_time`), "
+ "\n\t`id` bigint(20) not null,"
+ "\n\t`sellerId` bigint(20) default null,"
+ "\n\t`canvas_id` bigint(20) not null comment '画布ID',"
+ "\n\t`view_node_id` bigint(20) not null comment '对应显示的节点id',"
+ "\n\t`activity_type` int(11) not null comment '活动类型',"
+ "\n\t`node_type` int(11) not null comment '节点类型',"
+ "\n\t`node_title` varchar(200) not null comment '节点标题',"
+ "\n\t`status` int(11) not null default '0' comment '页面的显示状态',"
+ "\n\t`update_status` int(11) default null comment '节点创建后的修改状态',"
+ "\n\t`execute_status` int(11) default null comment '节点当前的执行状态',"
+ "\n\t`start_time` datetime default null comment '该节点活动的开始时间',"
+ "\n\t`end_time` datetime default null comment '该节点活动的结束时间',"
+ "\n\t`activity_start_time` datetime default null comment '营销活动的开始时间',"
+ "\n\t`activity_end_time` datetime default null comment '营销活动的结束时间',"
+ "\n\t`report_start_time` datetime default null comment '该节点活动效果报告的开始时间',"
+ "\n\t`report_end_time` datetime default null comment '该节点活动效果报告的结束时间',"
+ "\n\t`cron_rule` varchar(100) default null comment '周期性营销的时间表达式',"
+ "\n\t`split_rule` varchar(1000) default null comment '节点拆分规则',"
+ "\n\t`search_json` varchar(5000) default null comment '索引查找的条件字符串',"
+ "\n\t`filter_json` varchar(1000) default null comment '各种过滤条件的设置',"
+ "\n\t`buyer_count` int(11) default null comment '营销的会员数量',"
+ "\n\t`gmt_modified` datetime not null comment '活动最后修改时间',"
+ "\n\t`gmt_create` datetime not null comment '活动创建时间',"
+ "\n\tprimary key (`id`),"
+ "\n\tkey `canvas_id` (`canvas_id`),"
+ "\n\tkey `sid_ty_time` (`sellerId`, `node_type`, `start_time`),"
+ "\n\tconstraint `t_activity_node_ibfk_1` foreign key (`canvas_id`) references `t_activity_canvas` (`id`) on delete cascade on update cascade"
+ "\n) engine = InnoDB charset = utf8", output);
}
@@ -46,7 +46,7 @@ public class MySqlCreateTableTest55 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE tableA (" //
+ "\n\tdatasn varchar(100) NOT NULL, " //
+ "\n\tdatasn varchar(100) NOT NULL," //
+ "\n\tPRIMARY KEY (datasn)" //
+ "\n) ENGINE = MRG_MyISAM CHARSET = utf8 UNION = (tableB)", output);
@@ -47,14 +47,14 @@ public class MySqlCreateTableTest56 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE tableA (" //
+ "\n\tdatasn varchar(100) NOT NULL, " //
+ "\n\tdatasn varchar(100) NOT NULL," //
+ "\n\tPRIMARY KEY (datasn)" //
+ "\n) ENGINE = MRG_MyISAM CHARSET = utf8 UNION = (tableB, tableC)", output);
}
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table tableA (" //
+ "\n\tdatasn varchar(100) not null, " //
+ "\n\tdatasn varchar(100) not null," //
+ "\n\tprimary key (datasn)" //
+ "\n) engine = MRG_MyISAM charset = utf8 union = (tableB, tableC)", output);
}
@@ -50,11 +50,11 @@ public class MySqlCreateTableTest57 extends MysqlTest {
Assert.assertEquals(0, visitor.getConditions().size());
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `t_cpi_driskconfig_bak` (" + "\n\t`Sequence` bigint(20) NOT NULL AUTO_INCREMENT, "
+ "\n\t`comcode` varchar(20) BINARY NOT NULL, " + "\n\t`riskcode` varchar(10) BINARY NOT NULL, "
+ "\n\t`configcodehead` varchar(30) BINARY NOT NULL, " + "\n\t`configcodebody` varchar(100) BINARY , "
+ "\n\t`configvalue` varchar(200) BINARY , " + "\n\t`inputdate` datetime NOT NULL, "
+ "\n\t`validstatus` char(1) NOT NULL, " + "\n\t`remark` varchar(3000), " + "\n\t`flag` varchar(10), "
Assert.assertEquals("CREATE TABLE `t_cpi_driskconfig_bak` (" + "\n\t`Sequence` bigint(20) NOT NULL AUTO_INCREMENT,"
+ "\n\t`comcode` varchar(20) BINARY NOT NULL," + "\n\t`riskcode` varchar(10) BINARY NOT NULL,"
+ "\n\t`configcodehead` varchar(30) BINARY NOT NULL," + "\n\t`configcodebody` varchar(100) BINARY ,"
+ "\n\t`configvalue` varchar(200) BINARY ," + "\n\t`inputdate` datetime NOT NULL,"
+ "\n\t`validstatus` char(1) NOT NULL," + "\n\t`remark` varchar(3000)," + "\n\t`flag` varchar(10),"
+ "\n\tPRIMARY KEY (`Sequence`)" + "\n) ENGINE = InnoDB AUTO_INCREMENT = 49 CHARSET = utf8",output);
}
@@ -83,11 +83,11 @@ public class MySqlCreateTableTest57 extends MysqlTest {
Assert.assertEquals(0, visitor.getConditions().size());
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `t_cpi_driskconfig_bak` (" + "\n\t`Sequence` bigint(20) NOT NULL AUTO_INCREMENT, "
+ "\n\t`comcode` binary(20) NOT NULL, " + "\n\t`riskcode` varchar(10) BINARY NOT NULL, "
+ "\n\t`configcodehead` varchar(30) BINARY NOT NULL, " + "\n\t`configcodebody` varchar(100) BINARY , "
+ "\n\t`configvalue` varchar(200) BINARY , " + "\n\t`inputdate` datetime NOT NULL, "
+ "\n\t`validstatus` char(1) NOT NULL, " + "\n\t`remark` varchar(3000), " + "\n\t`flag` varchar(10), "
Assert.assertEquals("CREATE TABLE `t_cpi_driskconfig_bak` (" + "\n\t`Sequence` bigint(20) NOT NULL AUTO_INCREMENT,"
+ "\n\t`comcode` binary(20) NOT NULL," + "\n\t`riskcode` varchar(10) BINARY NOT NULL,"
+ "\n\t`configcodehead` varchar(30) BINARY NOT NULL," + "\n\t`configcodebody` varchar(100) BINARY ,"
+ "\n\t`configvalue` varchar(200) BINARY ," + "\n\t`inputdate` datetime NOT NULL,"
+ "\n\t`validstatus` char(1) NOT NULL," + "\n\t`remark` varchar(3000)," + "\n\t`flag` varchar(10),"
+ "\n\tPRIMARY KEY (`Sequence`)" + "\n) ENGINE = InnoDB AUTO_INCREMENT = 49 CHARSET = utf8",output);
}
@@ -49,56 +49,56 @@ public class MySqlCreateTableTest58 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `appservice_account` (" + //
"\n\t`id` integer NOT NULL PRIMARY KEY AUTO_INCREMENT, " + //
"\n\t`password` varchar(128) NOT NULL, " + //
"\n\t`last_login` datetime NOT NULL, " + //
"\n\t`username` varchar(40) NOT NULL UNIQUE, " + //
"\n\t`date_of_birth` date NOT NULL, " + //
"\n\t`head` varchar(100) NOT NULL, " + //
"\n\t`headThumb` varchar(100) NOT NULL, " + //
"\n\t`name` varchar(50) NOT NULL, " + //
"\n\t`gender` integer, " + //
"\n\t`uploadVideoCount` integer NOT NULL, " + //
"\n\t`fansCount` integer NOT NULL, " + //
"\n\t`balance` numeric(19, 2) NOT NULL, " + //
"\n\t`brick` integer NOT NULL, " + //
"\n\t`reward` integer NOT NULL, " + //
"\n\t`token` varchar(500) NOT NULL, " + //
"\n\t`weiboUserid` varchar(50) NOT NULL, " + //
"\n\t`weiboAccesstoken` varchar(500) NOT NULL, " + //
"\n\t`qqUserid` varchar(50) NOT NULL, " + //
"\n\t`qqAccesstoken` varchar(500) NOT NULL, " + //
"\n\t`wechatUserid` varchar(50) NOT NULL, " + //
"\n\t`wechatAccesstoken` varchar(500) NOT NULL, " + //
"\n\t`is_active` bool NOT NULL, " + //
"\n\t`id` integer NOT NULL PRIMARY KEY AUTO_INCREMENT," + //
"\n\t`password` varchar(128) NOT NULL," + //
"\n\t`last_login` datetime NOT NULL," + //
"\n\t`username` varchar(40) NOT NULL UNIQUE," + //
"\n\t`date_of_birth` date NOT NULL," + //
"\n\t`head` varchar(100) NOT NULL," + //
"\n\t`headThumb` varchar(100) NOT NULL," + //
"\n\t`name` varchar(50) NOT NULL," + //
"\n\t`gender` integer," + //
"\n\t`uploadVideoCount` integer NOT NULL," + //
"\n\t`fansCount` integer NOT NULL," + //
"\n\t`balance` numeric(19, 2) NOT NULL," + //
"\n\t`brick` integer NOT NULL," + //
"\n\t`reward` integer NOT NULL," + //
"\n\t`token` varchar(500) NOT NULL," + //
"\n\t`weiboUserid` varchar(50) NOT NULL," + //
"\n\t`weiboAccesstoken` varchar(500) NOT NULL," + //
"\n\t`qqUserid` varchar(50) NOT NULL," + //
"\n\t`qqAccesstoken` varchar(500) NOT NULL," + //
"\n\t`wechatUserid` varchar(50) NOT NULL," + //
"\n\t`wechatAccesstoken` varchar(500) NOT NULL," + //
"\n\t`is_active` bool NOT NULL," + //
"\n\t`is_admin` bool NOT NULL" + //
"\n)", output);
}
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table `appservice_account` (" + //
"\n\t`id` integer not null primary key auto_increment, " + //
"\n\t`password` varchar(128) not null, " + //
"\n\t`last_login` datetime not null, " + //
"\n\t`username` varchar(40) not null unique, " + //
"\n\t`date_of_birth` date not null, " + //
"\n\t`head` varchar(100) not null, " + //
"\n\t`headThumb` varchar(100) not null, " + //
"\n\t`name` varchar(50) not null, " + //
"\n\t`gender` integer, " + //
"\n\t`uploadVideoCount` integer not null, " + //
"\n\t`fansCount` integer not null, " + //
"\n\t`balance` numeric(19, 2) not null, " + //
"\n\t`brick` integer not null, " + //
"\n\t`reward` integer not null, " + //
"\n\t`token` varchar(500) not null, " + //
"\n\t`weiboUserid` varchar(50) not null, " + //
"\n\t`weiboAccesstoken` varchar(500) not null, " + //
"\n\t`qqUserid` varchar(50) not null, " + //
"\n\t`qqAccesstoken` varchar(500) not null, " + //
"\n\t`wechatUserid` varchar(50) not null, " + //
"\n\t`wechatAccesstoken` varchar(500) not null, " + //
"\n\t`is_active` bool not null, " + //
"\n\t`id` integer not null primary key auto_increment," + //
"\n\t`password` varchar(128) not null," + //
"\n\t`last_login` datetime not null," + //
"\n\t`username` varchar(40) not null unique," + //
"\n\t`date_of_birth` date not null," + //
"\n\t`head` varchar(100) not null," + //
"\n\t`headThumb` varchar(100) not null," + //
"\n\t`name` varchar(50) not null," + //
"\n\t`gender` integer," + //
"\n\t`uploadVideoCount` integer not null," + //
"\n\t`fansCount` integer not null," + //
"\n\t`balance` numeric(19, 2) not null," + //
"\n\t`brick` integer not null," + //
"\n\t`reward` integer not null," + //
"\n\t`token` varchar(500) not null," + //
"\n\t`weiboUserid` varchar(50) not null," + //
"\n\t`weiboAccesstoken` varchar(500) not null," + //
"\n\t`qqUserid` varchar(50) not null," + //
"\n\t`qqAccesstoken` varchar(500) not null," + //
"\n\t`wechatUserid` varchar(50) not null," + //
"\n\t`wechatAccesstoken` varchar(500) not null," + //
"\n\t`is_active` bool not null," + //
"\n\t`is_admin` bool not null" + //
"\n)", output);
}
@@ -38,7 +38,7 @@ public class MySqlCreateTableTest59 extends MysqlTest {
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t3 (" //
+ "\n\ta long, " //
+ "\n\ta long," //
+ "\n\tb long byte" //
+ "\n)", output);
@@ -39,14 +39,14 @@ public class MySqlCreateTableTest60 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t10 ("
+ "\n\tpk int PRIMARY KEY AUTO_INCREMENT, "
+ "\n\tpk int PRIMARY KEY AUTO_INCREMENT,"
+ "\n\tf1 varchar(65500) CHARSET latin1 "
+ "\n)", output);
}
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table t10 ("
+ "\n\tpk int primary key auto_increment, "
+ "\n\tpk int primary key auto_increment,"
+ "\n\tf1 varchar(65500) charset latin1 "
+ "\n)", output);
}
@@ -39,16 +39,16 @@ public class MySqlCreateTableTest61 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t ("
+ "\n\tpk int PRIMARY KEY AUTO_INCREMENT, "
+ "\n\ta timestamp NULL DEFAULT current_timestamp ON UPDATE current_timestamp, "
+ "\n\tpk int PRIMARY KEY AUTO_INCREMENT,"
+ "\n\ta timestamp NULL DEFAULT current_timestamp ON UPDATE current_timestamp,"
+ "\n\tb timestamp NULL"
+ "\n)", output);
}
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table t ("
+ "\n\tpk int primary key auto_increment, "
+ "\n\ta timestamp null default current_timestamp on update current_timestamp, "
+ "\n\tpk int primary key auto_increment,"
+ "\n\ta timestamp null default current_timestamp on update current_timestamp,"
+ "\n\tb timestamp null"
+ "\n)", output);
}
@@ -39,16 +39,16 @@ public class MySqlCreateTableTest63 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t ("
+ "\n\tpk int PRIMARY KEY AUTO_INCREMENT, "
+ "\n\ta TIMESTAMP, "
+ "\n\tpk int PRIMARY KEY AUTO_INCREMENT,"
+ "\n\ta TIMESTAMP,"
+ "\n\tKEY (a DESC)"
+ "\n)", output);
}
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table t ("
+ "\n\tpk int primary key auto_increment, "
+ "\n\ta TIMESTAMP, "
+ "\n\tpk int primary key auto_increment,"
+ "\n\ta TIMESTAMP,"
+ "\n\tkey (a desc)"
+ "\n)", output);
}
@@ -39,14 +39,14 @@ public class MySqlCreateTableTest64 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t ("
+ "\n\tc char(10), "
+ "\n\tc char(10),"
+ "\n\tUNIQUE a USING hash (c(1))"
+ "\n) CHARSET = utf8mb4 ENGINE = heap", output);
}
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table t ("
+ "\n\tc char(10), "
+ "\n\tc char(10),"
+ "\n\tunique a using hash (c(1))"
+ "\n) charset = utf8mb4 engine = heap", output);
}
@@ -39,14 +39,14 @@ public class MySqlCreateTableTest65 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t ("
+ "\n\tc char(10), "
+ "\n\tc char(10),"
+ "\n\tUNIQUE a USING btree (c(1))"
+ "\n) CHARSET = utf8mb4 ENGINE = heap", output);
}
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table t ("
+ "\n\tc char(10), "
+ "\n\tc char(10),"
+ "\n\tunique a using btree (c(1))"
+ "\n) charset = utf8mb4 engine = heap", output);
}
@@ -48,9 +48,9 @@ public class MySqlCreateTableTest66 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE hp_db.g20_relationship_communication_daily ("
+ "\n\ta_iden_string varchar, "
+ "\n\tb_iden_string varchar, "
+ "\n\tcounter bigint, "
+ "\n\ta_iden_string varchar,"
+ "\n\tb_iden_string varchar,"
+ "\n\tcounter bigint,"
+ "\n\tdurationtime bigint"
+ "\n)"
+ "\nPARTITION BY HASH KEY(a_iden_string) PARTITION NUM 100"
@@ -61,9 +61,9 @@ public class MySqlCreateTableTest66 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table hp_db.g20_relationship_communication_daily ("
+ "\n\ta_iden_string varchar, "
+ "\n\tb_iden_string varchar, "
+ "\n\tcounter bigint, "
+ "\n\ta_iden_string varchar,"
+ "\n\tb_iden_string varchar,"
+ "\n\tcounter bigint,"
+ "\n\tdurationtime bigint"
+ "\n)"
+ "\npartition by hash key(a_iden_string) partition num 100"
@@ -43,29 +43,33 @@ public class MySqlCreateTableTest67 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t1 ("
+ "\n\ta INT NOT NULL, "
+ "\n\tPRIMARY KEY (a)"
+ "\n) ENGINE = InnoDB TABLESPACE ts1"
+ "\nPARTITION BY RANGE (a) PARTITIONS 3"
+ "\n("
+ "\n\tPARTITION P1 VALUES LESS THAN (2),"
+ "\n\tPARTITION P2 VALUES LESS THAN (4) TABLESPACE ts2,"
+ "\n\tPARTITION P3 VALUES LESS THAN (6) TABLESPACE ts3"
+ "\n)", output);
Assert.assertEquals("CREATE TABLE t1 (\n" +
"\ta INT NOT NULL,\n" +
"\tPRIMARY KEY (a)\n" +
") ENGINE = InnoDB TABLESPACE ts1\n" +
"PARTITION BY RANGE (a) PARTITIONS 3\n" +
"(\n" +
"\tPARTITION P1 VALUES LESS THAN (2),\n" +
"\tPARTITION P2 VALUES LESS THAN (4)\n" +
"\t\tTABLESPACE ts2,\n" +
"\tPARTITION P3 VALUES LESS THAN (6)\n" +
"\t\tTABLESPACE ts3\n" +
")", output);
}
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table t1 ("
+ "\n\ta INT not null, "
+ "\n\tprimary key (a)"
+ "\n) engine = InnoDB tablespace ts1"
+ "\npartition by range (a) partitions 3"
+ "\n("
+ "\n\tpartition P1 values less than (2),"
+ "\n\tpartition P2 values less than (4) tablespace ts2,"
+ "\n\tpartition P3 values less than (6) tablespace ts3"
+ "\n)", output);
Assert.assertEquals("create table t1 (\n" +
"\ta INT not null,\n" +
"\tprimary key (a)\n" +
") engine = InnoDB tablespace ts1\n" +
"partition by range (a) partitions 3\n" +
"(\n" +
"\tpartition P1 values less than (2),\n" +
"\tpartition P2 values less than (4)\n" +
"\t\ttablespace ts2,\n" +
"\tpartition P3 values less than (6)\n" +
"\t\ttablespace ts3\n" +
")", output);
}
}
}
@@ -50,7 +50,7 @@ public class MySqlCreateTableTest68 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t1 ("
+ "\n\tyear_col INT, "
+ "\n\tyear_col INT,"
+ "\n\tsome_data INT"
+ "\n)"
+ "\nPARTITION BY RANGE (year_col)"
@@ -67,7 +67,7 @@ public class MySqlCreateTableTest68 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table t1 ("
+ "\n\tyear_col INT, "
+ "\n\tyear_col INT,"
+ "\n\tsome_data INT"
+ "\n)"
+ "\npartition by range (year_col)"
@@ -45,7 +45,7 @@ public class MySqlCreateTableTest69 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE t1 ("
+ "\n\ts1 INT, "
+ "\n\ts1 INT,"
+ "\n\ts2 INT AS (EXP(s1)) SORTED"
+ "\n)"
+ "\nPARTITION BY LIST (s2)"
@@ -57,7 +57,7 @@ public class MySqlCreateTableTest69 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table t1 ("
+ "\n\ts1 INT, "
+ "\n\ts1 INT,"
+ "\n\ts2 INT as (EXP(s1)) sorted"
+ "\n)"
+ "\npartition by list (s2)"
@@ -62,17 +62,17 @@ public class MySqlCreateTableTest70 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `app_customer_license` ("
+ "\n\t`id` bigint(20) NOT NULL AUTO_INCREMENT, "
+ "\n\t`created_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, "
+ "\n\t`created_date` datetime NOT NULL, "
+ "\n\t`last_modified_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, "
+ "\n\t`last_modified_date` datetime NULL DEFAULT NULL, "
+ "\n\t`version` bigint(20) NOT NULL, "
+ "\n\t`device_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, "
+ "\n\t`customer_info` bigint(20) NULL DEFAULT NULL, "
+ "\n\tPRIMARY KEY (`id`), "
+ "\n\tFOREIGN KEY (`customer_info`) REFERENCES `app_customer_info` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, "
+ "\n\tINDEX `fk_app_customer_info_id` USING BTREE(`customer_info`), "
+ "\n\t`id` bigint(20) NOT NULL AUTO_INCREMENT,"
+ "\n\t`created_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,"
+ "\n\t`created_date` datetime NOT NULL,"
+ "\n\t`last_modified_by` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,"
+ "\n\t`last_modified_date` datetime NULL DEFAULT NULL,"
+ "\n\t`version` bigint(20) NOT NULL,"
+ "\n\t`device_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,"
+ "\n\t`customer_info` bigint(20) NULL DEFAULT NULL,"
+ "\n\tPRIMARY KEY (`id`),"
+ "\n\tFOREIGN KEY (`customer_info`) REFERENCES `app_customer_info` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,"
+ "\n\tINDEX `fk_app_customer_info_id` USING BTREE(`customer_info`),"
+ "\n\tUNIQUE `idx_app_customer_license_deviceId` USING BTREE (`device_id`)"
+ "\n) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE utf8_general_ci AUTO_INCREMENT = 1 ROW_FORMAT = DYNAMIC", output);
}
@@ -80,17 +80,17 @@ public class MySqlCreateTableTest70 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table `app_customer_license` ("
+ "\n\t`id` bigint(20) not null auto_increment, "
+ "\n\t`created_by` varchar(50) character set utf8 collate utf8_general_ci not null, "
+ "\n\t`created_date` datetime not null, "
+ "\n\t`last_modified_by` varchar(50) character set utf8 collate utf8_general_ci null default null, "
+ "\n\t`last_modified_date` datetime null default null, "
+ "\n\t`version` bigint(20) not null, "
+ "\n\t`device_id` varchar(20) character set utf8 collate utf8_general_ci not null, "
+ "\n\t`customer_info` bigint(20) null default null, "
+ "\n\tprimary key (`id`), "
+ "\n\tforeign key (`customer_info`) references `app_customer_info` (`id`) on delete restrict on update restrict, "
+ "\n\tindex `fk_app_customer_info_id` using BTREE(`customer_info`), "
+ "\n\t`id` bigint(20) not null auto_increment,"
+ "\n\t`created_by` varchar(50) character set utf8 collate utf8_general_ci not null,"
+ "\n\t`created_date` datetime not null,"
+ "\n\t`last_modified_by` varchar(50) character set utf8 collate utf8_general_ci null default null,"
+ "\n\t`last_modified_date` datetime null default null,"
+ "\n\t`version` bigint(20) not null,"
+ "\n\t`device_id` varchar(20) character set utf8 collate utf8_general_ci not null,"
+ "\n\t`customer_info` bigint(20) null default null,"
+ "\n\tprimary key (`id`),"
+ "\n\tforeign key (`customer_info`) references `app_customer_info` (`id`) on delete restrict on update restrict,"
+ "\n\tindex `fk_app_customer_info_id` using BTREE(`customer_info`),"
+ "\n\tunique `idx_app_customer_license_deviceId` using BTREE (`device_id`)"
+ "\n) engine = InnoDB character set = utf8 collate utf8_general_ci auto_increment = 1 row_format = DYNAMIC", output);
}
@@ -47,9 +47,9 @@ public class MySqlCreateTableTest71 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE xx ("
+ "\n\tid bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'aa', "
+ "\n\tgmt_create datetime NOT NULL COMMENT '创建时间', "
+ "\n\tgmt_modified datetime NOT NULL COMMENT '修改时间', "
+ "\n\tid bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'aa',"
+ "\n\tgmt_create datetime NOT NULL COMMENT '创建时间',"
+ "\n\tgmt_modified datetime NOT NULL COMMENT '修改时间',"
+ "\n\tPRIMARY KEY (id)"
+ "\n) COMMENT = 're'", output);
}
@@ -57,9 +57,9 @@ public class MySqlCreateTableTest71 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table xx ("
+ "\n\tid bigint unsigned not null auto_increment comment 'aa', "
+ "\n\tgmt_create datetime not null comment '创建时间', "
+ "\n\tgmt_modified datetime not null comment '修改时间', "
+ "\n\tid bigint unsigned not null auto_increment comment 'aa',"
+ "\n\tgmt_create datetime not null comment '创建时间',"
+ "\n\tgmt_modified datetime not null comment '修改时间',"
+ "\n\tprimary key (id)"
+ "\n) comment = 're'", output);
}
@@ -49,9 +49,9 @@ public class MySqlCreateTableTest72 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE \"MessageInstance\" ("
+ "\n\t\"id\" int(11) NOT NULL AUTO_INCREMENT, "
+ "\n\t\"messageId\" int(11) NOT NULL, "
+ "\n\tPRIMARY KEY ('id'), "
+ "\n\t\"id\" int(11) NOT NULL AUTO_INCREMENT,"
+ "\n\t\"messageId\" int(11) NOT NULL,"
+ "\n\tPRIMARY KEY ('id'),"
+ "\n\tKEY \"ix_messageId\" ('messageId')"
+ "\n)", output);
}
@@ -59,9 +59,9 @@ public class MySqlCreateTableTest72 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table \"MessageInstance\" ("
+ "\n\t\"id\" int(11) not null auto_increment, "
+ "\n\t\"messageId\" int(11) not null, "
+ "\n\tprimary key ('id'), "
+ "\n\t\"id\" int(11) not null auto_increment,"
+ "\n\t\"messageId\" int(11) not null,"
+ "\n\tprimary key ('id'),"
+ "\n\tkey \"ix_messageId\" ('messageId')"
+ "\n)", output);
}
@@ -47,8 +47,8 @@ public class MySqlCreateTableTest73 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE total ("
+ "\n\tid INT NOT NULL AUTO_INCREMENT, "
+ "\n\tmessage CHAR(20), "
+ "\n\tid INT NOT NULL AUTO_INCREMENT,"
+ "\n\tmessage CHAR(20),"
+ "\n\tINDEX(a)"
+ "\n) ENGINE = MERGE UNION = (t1, t2) INSERT_METHOD = LAST", output);
}
@@ -56,8 +56,8 @@ public class MySqlCreateTableTest73 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table total ("
+ "\n\tid INT not null auto_increment, "
+ "\n\tmessage CHAR(20), "
+ "\n\tid INT not null auto_increment,"
+ "\n\tmessage CHAR(20),"
+ "\n\tindex(a)"
+ "\n) engine = MERGE union = (t1, t2) insert_method = LAST", output);
}
@@ -43,19 +43,19 @@ public class MySqlCreateTableTest74 extends MysqlTest {
MySqlSchemaStatVisitor visitor = new MySqlSchemaStatVisitor();
stmt.accept(visitor);
Column column = visitor.getColumn("test.simple_test", "col_key");
Column column = visitor.getColumn("test.simple_test","col_key");
Assert.assertNotNull(column);
Assert.assertEquals("bigint", column.getDataType());
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE test.simple_test (\n" +
"\tcol_key bigint(20) NOT NULL AUTO_INCREMENT, \n" +
"\tcol1 varchar(45) NULL, \n" +
"\tcol2 tinyint(4) NULL, \n" +
"\tcol3 datetime NULL, \n" +
"\tcol4 timestamp NULL DEFAULT current_timestamp ON UPDATE current_timestamp, \n" +
"\tPRIMARY KEY (col_key), \n" +
"\tcol_key bigint(20) NOT NULL AUTO_INCREMENT,\n" +
"\tcol1 varchar(45) NULL,\n" +
"\tcol2 tinyint(4) NULL,\n" +
"\tcol3 datetime NULL,\n" +
"\tcol4 timestamp NULL DEFAULT current_timestamp ON UPDATE current_timestamp,\n" +
"\tPRIMARY KEY (col_key),\n" +
"\tUNIQUE v1_unique (col_key ASC)\n" +
")", output);
}
@@ -63,12 +63,12 @@ public class MySqlCreateTableTest74 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table test.simple_test (\n" +
"\tcol_key bigint(20) not null auto_increment, \n" +
"\tcol1 varchar(45) null, \n" +
"\tcol2 tinyint(4) null, \n" +
"\tcol3 datetime null, \n" +
"\tcol4 timestamp null default current_timestamp on update current_timestamp, \n" +
"\tprimary key (col_key), \n" +
"\tcol_key bigint(20) not null auto_increment,\n" +
"\tcol1 varchar(45) null,\n" +
"\tcol2 tinyint(4) null,\n" +
"\tcol3 datetime null,\n" +
"\tcol4 timestamp null default current_timestamp on update current_timestamp,\n" +
"\tprimary key (col_key),\n" +
"\tunique v1_unique (col_key asc)\n" +
")", output);
}
@@ -62,23 +62,23 @@ public class MySqlCreateTableTest75 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `sys_msg_entry_0320` (\n" +
"\t`provider_dsp_name` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '消息提供者的显示名,提供给一些需要统一发送名称的系统消息', \n" +
"\t`template_data` varchar(2048) NOT NULL /*!50616 COLUMN_FORMAT COMPRESSED */ COMMENT '模板渲染时使用的数据,key-value对', \n" +
"\t`template_merge_data` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '对于需要合并的消息,被合并的参数放在此处理', \n" +
"\t`expiration_date` datetime NOT NULL COMMENT '失效日期,精度到天,查询和任务处理时使用', \n" +
"\t`merge_key` varchar(128) DEFAULT NULL COMMENT '消息合并主键,合并成功的消息,不参与计数', \n" +
"\t`out_id` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '外部关联源的id', \n" +
"\t`number_expiration_date` datetime DEFAULT NULL COMMENT '计数过期时间', \n" +
"\t`hidden` int(11) DEFAULT '0' COMMENT '标记是否在吊顶展示,1表示隐藏,0表示展示', \n" +
"\t`popup` tinyint(3) UNSIGNED DEFAULT '0' COMMENT '表示消息提醒方式:0-数字提醒,1-layer,2-popup', \n" +
"\t`tag_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'TAG标志', \n" +
"\t`attribute` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '消息的一些属性', \n" +
"\t`original_msg_ids` varchar(1024) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '原始消息ID,多个id用半角逗号隔开', \n" +
"\tPRIMARY KEY (`id`), \n" +
"\tKEY `idx_expiration_date` (`expiration_date`), \n" +
"\tKEY `k_rid_hidd_cid` (`receiver_id`, `hidden`, `cat_id`, `expiration_date`), \n" +
"\tKEY `k_rid_aid_tid` (`receiver_id`, `app_id`, `type_id`, `expiration_date`), \n" +
"\tKEY `k_rid_stat_popup` (`receiver_id`, `status`, `popup`, `expiration_date`), \n" +
"\t`provider_dsp_name` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '消息提供者的显示名,提供给一些需要统一发送名称的系统消息',\n" +
"\t`template_data` varchar(2048) NOT NULL /*!50616 COLUMN_FORMAT COMPRESSED */ COMMENT '模板渲染时使用的数据,key-value对',\n" +
"\t`template_merge_data` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '对于需要合并的消息,被合并的参数放在此处理',\n" +
"\t`expiration_date` datetime NOT NULL COMMENT '失效日期,精度到天,查询和任务处理时使用',\n" +
"\t`merge_key` varchar(128) DEFAULT NULL COMMENT '消息合并主键,合并成功的消息,不参与计数',\n" +
"\t`out_id` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '外部关联源的id',\n" +
"\t`number_expiration_date` datetime DEFAULT NULL COMMENT '计数过期时间',\n" +
"\t`hidden` int(11) DEFAULT '0' COMMENT '标记是否在吊顶展示,1表示隐藏,0表示展示',\n" +
"\t`popup` tinyint(3) UNSIGNED DEFAULT '0' COMMENT '表示消息提醒方式:0-数字提醒,1-layer,2-popup',\n" +
"\t`tag_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'TAG标志',\n" +
"\t`attribute` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '消息的一些属性',\n" +
"\t`original_msg_ids` varchar(1024) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '原始消息ID,多个id用半角逗号隔开',\n" +
"\tPRIMARY KEY (`id`),\n" +
"\tKEY `idx_expiration_date` (`expiration_date`),\n" +
"\tKEY `k_rid_hidd_cid` (`receiver_id`, `hidden`, `cat_id`, `expiration_date`),\n" +
"\tKEY `k_rid_aid_tid` (`receiver_id`, `app_id`, `type_id`, `expiration_date`),\n" +
"\tKEY `k_rid_stat_popup` (`receiver_id`, `status`, `popup`, `expiration_date`),\n" +
"\tKEY `k_tid` (`tag_id`)\n" +
") ENGINE = InnoDB AUTO_INCREMENT = 167279613030 CHARSET = gbk COMMENT = '消息实体表'", output);
}
@@ -86,23 +86,23 @@ public class MySqlCreateTableTest75 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table `sys_msg_entry_0320` (\n" +
"\t`provider_dsp_name` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '消息提供者的显示名,提供给一些需要统一发送名称的系统消息', \n" +
"\t`template_data` varchar(2048) not null /*!50616 COLUMN_FORMAT COMPRESSED */ comment '模板渲染时使用的数据,key-value对', \n" +
"\t`template_merge_data` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '对于需要合并的消息,被合并的参数放在此处理', \n" +
"\t`expiration_date` datetime not null comment '失效日期,精度到天,查询和任务处理时使用', \n" +
"\t`merge_key` varchar(128) default null comment '消息合并主键,合并成功的消息,不参与计数', \n" +
"\t`out_id` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '外部关联源的id', \n" +
"\t`number_expiration_date` datetime default null comment '计数过期时间', \n" +
"\t`hidden` int(11) default '0' comment '标记是否在吊顶展示,1表示隐藏,0表示展示', \n" +
"\t`popup` tinyint(3) unsigned default '0' comment '表示消息提醒方式:0-数字提醒,1-layer,2-popup', \n" +
"\t`tag_id` bigint(20) unsigned default null comment 'TAG标志', \n" +
"\t`attribute` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '消息的一些属性', \n" +
"\t`original_msg_ids` varchar(1024) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '原始消息ID,多个id用半角逗号隔开', \n" +
"\tprimary key (`id`), \n" +
"\tkey `idx_expiration_date` (`expiration_date`), \n" +
"\tkey `k_rid_hidd_cid` (`receiver_id`, `hidden`, `cat_id`, `expiration_date`), \n" +
"\tkey `k_rid_aid_tid` (`receiver_id`, `app_id`, `type_id`, `expiration_date`), \n" +
"\tkey `k_rid_stat_popup` (`receiver_id`, `status`, `popup`, `expiration_date`), \n" +
"\t`provider_dsp_name` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '消息提供者的显示名,提供给一些需要统一发送名称的系统消息',\n" +
"\t`template_data` varchar(2048) not null /*!50616 COLUMN_FORMAT COMPRESSED */ comment '模板渲染时使用的数据,key-value对',\n" +
"\t`template_merge_data` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '对于需要合并的消息,被合并的参数放在此处理',\n" +
"\t`expiration_date` datetime not null comment '失效日期,精度到天,查询和任务处理时使用',\n" +
"\t`merge_key` varchar(128) default null comment '消息合并主键,合并成功的消息,不参与计数',\n" +
"\t`out_id` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '外部关联源的id',\n" +
"\t`number_expiration_date` datetime default null comment '计数过期时间',\n" +
"\t`hidden` int(11) default '0' comment '标记是否在吊顶展示,1表示隐藏,0表示展示',\n" +
"\t`popup` tinyint(3) unsigned default '0' comment '表示消息提醒方式:0-数字提醒,1-layer,2-popup',\n" +
"\t`tag_id` bigint(20) unsigned default null comment 'TAG标志',\n" +
"\t`attribute` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '消息的一些属性',\n" +
"\t`original_msg_ids` varchar(1024) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '原始消息ID,多个id用半角逗号隔开',\n" +
"\tprimary key (`id`),\n" +
"\tkey `idx_expiration_date` (`expiration_date`),\n" +
"\tkey `k_rid_hidd_cid` (`receiver_id`, `hidden`, `cat_id`, `expiration_date`),\n" +
"\tkey `k_rid_aid_tid` (`receiver_id`, `app_id`, `type_id`, `expiration_date`),\n" +
"\tkey `k_rid_stat_popup` (`receiver_id`, `status`, `popup`, `expiration_date`),\n" +
"\tkey `k_tid` (`tag_id`)\n" +
") engine = InnoDB auto_increment = 167279613030 charset = gbk comment = '消息实体表'", output);
}
@@ -62,23 +62,23 @@ public class MySqlCreateTableTest76 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE `sys_msg_entry_0320` (\n" +
"\t`provider_dsp_name` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '消息提供者的显示名,提供给一些需要统一发送名称的系统消息', \n" +
"\t`template_data` varchar(2048) NOT NULL /*!50616 COLUMN_FORMAT COMPRESSED */ COMMENT '模板渲染时使用的数据,key-value对', \n" +
"\t`template_merge_data` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '对于需要合并的消息,被合并的参数放在此处理', \n" +
"\t`expiration_date` datetime NOT NULL COMMENT '失效日期,精度到天,查询和任务处理时使用', \n" +
"\t`merge_key` varchar(128) DEFAULT NULL COMMENT '消息合并主键,合并成功的消息,不参与计数', \n" +
"\t`out_id` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '外部关联源的id', \n" +
"\t`number_expiration_date` datetime DEFAULT NULL COMMENT '计数过期时间', \n" +
"\t`hidden` int(11) DEFAULT '0' COMMENT '标记是否在吊顶展示,1表示隐藏,0表示展示', \n" +
"\t`popup` tinyint(3) UNSIGNED DEFAULT '0' COMMENT '表示消息提醒方式:0-数字提醒,1-layer,2-popup', \n" +
"\t`tag_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'TAG标志', \n" +
"\t`attribute` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '消息的一些属性', \n" +
"\t`original_msg_ids` varchar(1024) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '原始消息ID,多个id用半角逗号隔开', \n" +
"\tPRIMARY KEY (`id`), \n" +
"\tKEY `idx_expiration_date` (`expiration_date`), \n" +
"\tKEY `k_rid_hidd_cid` (`receiver_id`, `hidden`, `cat_id`, `expiration_date`), \n" +
"\tKEY `k_rid_aid_tid` (`receiver_id`, `app_id`, `type_id`, `expiration_date`), \n" +
"\tKEY `k_rid_stat_popup` (`receiver_id`, `status`, `popup`, `expiration_date`), \n" +
"\t`provider_dsp_name` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '消息提供者的显示名,提供给一些需要统一发送名称的系统消息',\n" +
"\t`template_data` varchar(2048) NOT NULL /*!50616 COLUMN_FORMAT COMPRESSED */ COMMENT '模板渲染时使用的数据,key-value对',\n" +
"\t`template_merge_data` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '对于需要合并的消息,被合并的参数放在此处理',\n" +
"\t`expiration_date` datetime NOT NULL COMMENT '失效日期,精度到天,查询和任务处理时使用',\n" +
"\t`merge_key` varchar(128) DEFAULT NULL COMMENT '消息合并主键,合并成功的消息,不参与计数',\n" +
"\t`out_id` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '外部关联源的id',\n" +
"\t`number_expiration_date` datetime DEFAULT NULL COMMENT '计数过期时间',\n" +
"\t`hidden` int(11) DEFAULT '0' COMMENT '标记是否在吊顶展示,1表示隐藏,0表示展示',\n" +
"\t`popup` tinyint(3) UNSIGNED DEFAULT '0' COMMENT '表示消息提醒方式:0-数字提醒,1-layer,2-popup',\n" +
"\t`tag_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT 'TAG标志',\n" +
"\t`attribute` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '消息的一些属性',\n" +
"\t`original_msg_ids` varchar(1024) /*!50616 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL COMMENT '原始消息ID,多个id用半角逗号隔开',\n" +
"\tPRIMARY KEY (`id`),\n" +
"\tKEY `idx_expiration_date` (`expiration_date`),\n" +
"\tKEY `k_rid_hidd_cid` (`receiver_id`, `hidden`, `cat_id`, `expiration_date`),\n" +
"\tKEY `k_rid_aid_tid` (`receiver_id`, `app_id`, `type_id`, `expiration_date`),\n" +
"\tKEY `k_rid_stat_popup` (`receiver_id`, `status`, `popup`, `expiration_date`),\n" +
"\tKEY `k_tid` (`tag_id`)\n" +
") ENGINE = InnoDB AUTO_INCREMENT = 167279613030 CHARSET = gbk COMMENT = '消息实体表'", output);
}
@@ -86,23 +86,23 @@ public class MySqlCreateTableTest76 extends MysqlTest {
{
String output = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table `sys_msg_entry_0320` (\n" +
"\t`provider_dsp_name` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '消息提供者的显示名,提供给一些需要统一发送名称的系统消息', \n" +
"\t`template_data` varchar(2048) not null /*!50616 COLUMN_FORMAT COMPRESSED */ comment '模板渲染时使用的数据,key-value对', \n" +
"\t`template_merge_data` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '对于需要合并的消息,被合并的参数放在此处理', \n" +
"\t`expiration_date` datetime not null comment '失效日期,精度到天,查询和任务处理时使用', \n" +
"\t`merge_key` varchar(128) default null comment '消息合并主键,合并成功的消息,不参与计数', \n" +
"\t`out_id` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '外部关联源的id', \n" +
"\t`number_expiration_date` datetime default null comment '计数过期时间', \n" +
"\t`hidden` int(11) default '0' comment '标记是否在吊顶展示,1表示隐藏,0表示展示', \n" +
"\t`popup` tinyint(3) unsigned default '0' comment '表示消息提醒方式:0-数字提醒,1-layer,2-popup', \n" +
"\t`tag_id` bigint(20) unsigned default null comment 'TAG标志', \n" +
"\t`attribute` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '消息的一些属性', \n" +
"\t`original_msg_ids` varchar(1024) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '原始消息ID,多个id用半角逗号隔开', \n" +
"\tprimary key (`id`), \n" +
"\tkey `idx_expiration_date` (`expiration_date`), \n" +
"\tkey `k_rid_hidd_cid` (`receiver_id`, `hidden`, `cat_id`, `expiration_date`), \n" +
"\tkey `k_rid_aid_tid` (`receiver_id`, `app_id`, `type_id`, `expiration_date`), \n" +
"\tkey `k_rid_stat_popup` (`receiver_id`, `status`, `popup`, `expiration_date`), \n" +
"\t`provider_dsp_name` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '消息提供者的显示名,提供给一些需要统一发送名称的系统消息',\n" +
"\t`template_data` varchar(2048) not null /*!50616 COLUMN_FORMAT COMPRESSED */ comment '模板渲染时使用的数据,key-value对',\n" +
"\t`template_merge_data` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '对于需要合并的消息,被合并的参数放在此处理',\n" +
"\t`expiration_date` datetime not null comment '失效日期,精度到天,查询和任务处理时使用',\n" +
"\t`merge_key` varchar(128) default null comment '消息合并主键,合并成功的消息,不参与计数',\n" +
"\t`out_id` varchar(256) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '外部关联源的id',\n" +
"\t`number_expiration_date` datetime default null comment '计数过期时间',\n" +
"\t`hidden` int(11) default '0' comment '标记是否在吊顶展示,1表示隐藏,0表示展示',\n" +
"\t`popup` tinyint(3) unsigned default '0' comment '表示消息提醒方式:0-数字提醒,1-layer,2-popup',\n" +
"\t`tag_id` bigint(20) unsigned default null comment 'TAG标志',\n" +
"\t`attribute` varchar(512) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '消息的一些属性',\n" +
"\t`original_msg_ids` varchar(1024) /*!50616 COLUMN_FORMAT COMPRESSED */ default null comment '原始消息ID,多个id用半角逗号隔开',\n" +
"\tprimary key (`id`),\n" +
"\tkey `idx_expiration_date` (`expiration_date`),\n" +
"\tkey `k_rid_hidd_cid` (`receiver_id`, `hidden`, `cat_id`, `expiration_date`),\n" +
"\tkey `k_rid_aid_tid` (`receiver_id`, `app_id`, `type_id`, `expiration_date`),\n" +
"\tkey `k_rid_stat_popup` (`receiver_id`, `status`, `popup`, `expiration_date`),\n" +
"\tkey `k_tid` (`tag_id`)\n" +
") engine = InnoDB auto_increment = 167279613030 charset = gbk comment = '消息实体表'", output);
}
@@ -37,7 +37,7 @@ public class OceanbaseCreateTableTest_partitionByHash extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE tnhash ("
+ "\n\tid INT, "
+ "\n\tid INT,"
+ "\n\tname VARCHAR(5)"
+ "\n)"
+ "\nPARTITION BY HASH (id) PARTITIONS 2",
@@ -46,7 +46,7 @@ public class OceanbaseCreateTableTest_partitionByHash extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table tnhash ("
+ "\n\tid INT, "
+ "\n\tid INT,"
+ "\n\tname VARCHAR(5)"
+ "\n)"
+ "\npartition by hash (id) partitions 2",
@@ -44,12 +44,12 @@ public class OceanbaseCreateTableTest_partitionByHash2 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE employees ("
+ "\n\tid INT NOT NULL, "
+ "\n\tfname VARCHAR(30), "
+ "\n\tlname VARCHAR(30), "
+ "\n\thired DATE NOT NULL DEFAULT '1970-01-01', "
+ "\n\tseparated DATE NOT NULL DEFAULT '9999-12-31', "
+ "\n\tjob_code INT, "
+ "\n\tid INT NOT NULL,"
+ "\n\tfname VARCHAR(30),"
+ "\n\tlname VARCHAR(30),"
+ "\n\thired DATE NOT NULL DEFAULT '1970-01-01',"
+ "\n\tseparated DATE NOT NULL DEFAULT '9999-12-31',"
+ "\n\tjob_code INT,"
+ "\n\tstore_id INT"
+ "\n)"
+ "\nPARTITION BY HASH (YEAR(hired)) PARTITIONS 4",
@@ -58,12 +58,12 @@ public class OceanbaseCreateTableTest_partitionByHash2 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table employees ("
+ "\n\tid INT not null, "
+ "\n\tfname VARCHAR(30), "
+ "\n\tlname VARCHAR(30), "
+ "\n\thired DATE not null default '1970-01-01', "
+ "\n\tseparated DATE not null default '9999-12-31', "
+ "\n\tjob_code INT, "
+ "\n\tid INT not null,"
+ "\n\tfname VARCHAR(30),"
+ "\n\tlname VARCHAR(30),"
+ "\n\thired DATE not null default '1970-01-01',"
+ "\n\tseparated DATE not null default '9999-12-31',"
+ "\n\tjob_code INT,"
+ "\n\tstore_id INT"
+ "\n)"
+ "\npartition by hash (YEAR(hired)) partitions 4",
@@ -37,7 +37,7 @@ public class OceanbaseCreateTableTest_partitionByKey extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE k2 ("
+ "\n\tid int PRIMARY KEY, "
+ "\n\tid int PRIMARY KEY,"
+ "\n\tname varchar(20)"
+ "\n)"
+ "\nPARTITION BY KEY () PARTITIONS 2",
@@ -46,7 +46,7 @@ public class OceanbaseCreateTableTest_partitionByKey extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table k2 ("
+ "\n\tid int primary key, "
+ "\n\tid int primary key,"
+ "\n\tname varchar(20)"
+ "\n)"
+ "\npartition by key () partitions 2",
@@ -46,12 +46,12 @@ public class OceanbaseCreateTableTest_rangePartition extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE employees ("
+ "\n\tid INT NOT NULL, "
+ "\n\tfname VARCHAR(30), "
+ "\n\tlname VARCHAR(30), "
+ "\n\thired DATE NOT NULL DEFAULT '1970-01-01', "
+ "\n\tseparated DATE NOT NULL DEFAULT '9999-12-31', "
+ "\n\tjob_code INT NOT NULL, "
+ "\n\tid INT NOT NULL,"
+ "\n\tfname VARCHAR(30),"
+ "\n\tlname VARCHAR(30),"
+ "\n\thired DATE NOT NULL DEFAULT '1970-01-01',"
+ "\n\tseparated DATE NOT NULL DEFAULT '9999-12-31',"
+ "\n\tjob_code INT NOT NULL,"
+ "\n\tstore_id INT NOT NULL"
+ "\n)"
+ "\nPARTITION BY RANGE (store_id)"
@@ -66,12 +66,12 @@ public class OceanbaseCreateTableTest_rangePartition extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table employees ("
+ "\n\tid INT not null, "
+ "\n\tfname VARCHAR(30), "
+ "\n\tlname VARCHAR(30), "
+ "\n\thired DATE not null default '1970-01-01', "
+ "\n\tseparated DATE not null default '9999-12-31', "
+ "\n\tjob_code INT not null, "
+ "\n\tid INT not null,"
+ "\n\tfname VARCHAR(30),"
+ "\n\tlname VARCHAR(30),"
+ "\n\thired DATE not null default '1970-01-01',"
+ "\n\tseparated DATE not null default '9999-12-31',"
+ "\n\tjob_code INT not null,"
+ "\n\tstore_id INT not null"
+ "\n)"
+ "\npartition by range (store_id)"
@@ -49,12 +49,12 @@ public class OceanbaseCreateTableTest_rangePartition2 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE employees ("
+ "\n\tid INT NOT NULL, "
+ "\n\tfname VARCHAR(30), "
+ "\n\tlname VARCHAR(30), "
+ "\n\thired DATE NOT NULL DEFAULT '1970-01-01', "
+ "\n\tseparated DATE NOT NULL DEFAULT '9999-12-31', "
+ "\n\tjob_code INT NOT NULL, "
+ "\n\tid INT NOT NULL,"
+ "\n\tfname VARCHAR(30),"
+ "\n\tlname VARCHAR(30),"
+ "\n\thired DATE NOT NULL DEFAULT '1970-01-01',"
+ "\n\tseparated DATE NOT NULL DEFAULT '9999-12-31',"
+ "\n\tjob_code INT NOT NULL,"
+ "\n\tstore_id INT NOT NULL"
+ "\n)"
+ "\nPARTITION BY RANGE (store_id)"
@@ -69,12 +69,12 @@ public class OceanbaseCreateTableTest_rangePartition2 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table employees ("
+ "\n\tid INT not null, "
+ "\n\tfname VARCHAR(30), "
+ "\n\tlname VARCHAR(30), "
+ "\n\thired DATE not null default '1970-01-01', "
+ "\n\tseparated DATE not null default '9999-12-31', "
+ "\n\tjob_code INT not null, "
+ "\n\tid INT not null,"
+ "\n\tfname VARCHAR(30),"
+ "\n\tlname VARCHAR(30),"
+ "\n\thired DATE not null default '1970-01-01',"
+ "\n\tseparated DATE not null default '9999-12-31',"
+ "\n\tjob_code INT not null,"
+ "\n\tstore_id INT not null"
+ "\n)"
+ "\npartition by range (store_id)"
@@ -48,12 +48,12 @@ public class OceanbaseCreateTableTest_rangePartition3 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE employees ("
+ "\n\tid INT NOT NULL, "
+ "\n\tfname VARCHAR(30), "
+ "\n\tlname VARCHAR(30), "
+ "\n\thired DATE NOT NULL DEFAULT '1970-01-01', "
+ "\n\tseparated DATE NOT NULL DEFAULT '9999-12-31', "
+ "\n\tjob_code INT NOT NULL, "
+ "\n\tid INT NOT NULL,"
+ "\n\tfname VARCHAR(30),"
+ "\n\tlname VARCHAR(30),"
+ "\n\thired DATE NOT NULL DEFAULT '1970-01-01',"
+ "\n\tseparated DATE NOT NULL DEFAULT '9999-12-31',"
+ "\n\tjob_code INT NOT NULL,"
+ "\n\tstore_id INT NOT NULL"
+ "\n)"
+ "\nPARTITION BY RANGE (job_code)"
@@ -67,12 +67,12 @@ public class OceanbaseCreateTableTest_rangePartition3 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table employees ("
+ "\n\tid INT not null, "
+ "\n\tfname VARCHAR(30), "
+ "\n\tlname VARCHAR(30), "
+ "\n\thired DATE not null default '1970-01-01', "
+ "\n\tseparated DATE not null default '9999-12-31', "
+ "\n\tjob_code INT not null, "
+ "\n\tid INT not null,"
+ "\n\tfname VARCHAR(30),"
+ "\n\tlname VARCHAR(30),"
+ "\n\thired DATE not null default '1970-01-01',"
+ "\n\tseparated DATE not null default '9999-12-31',"
+ "\n\tjob_code INT not null,"
+ "\n\tstore_id INT not null"
+ "\n)"
+ "\npartition by range (job_code)"
@@ -48,12 +48,12 @@ public class OceanbaseCreateTableTest_rangePartition4 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE employees ("
+ "\n\tid INT NOT NULL, "
+ "\n\tfname VARCHAR(30), "
+ "\n\tlname VARCHAR(30), "
+ "\n\thired DATE NOT NULL DEFAULT '1970-01-01', "
+ "\n\tseparated DATE NOT NULL DEFAULT '9999-12-31', "
+ "\n\tjob_code INT, "
+ "\n\tid INT NOT NULL,"
+ "\n\tfname VARCHAR(30),"
+ "\n\tlname VARCHAR(30),"
+ "\n\thired DATE NOT NULL DEFAULT '1970-01-01',"
+ "\n\tseparated DATE NOT NULL DEFAULT '9999-12-31',"
+ "\n\tjob_code INT,"
+ "\n\tstore_id INT"
+ "\n)"
+ "\nPARTITION BY RANGE (YEAR(separated))"
@@ -68,12 +68,12 @@ public class OceanbaseCreateTableTest_rangePartition4 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table employees ("
+ "\n\tid INT not null, "
+ "\n\tfname VARCHAR(30), "
+ "\n\tlname VARCHAR(30), "
+ "\n\thired DATE not null default '1970-01-01', "
+ "\n\tseparated DATE not null default '9999-12-31', "
+ "\n\tjob_code INT, "
+ "\n\tid INT not null,"
+ "\n\tfname VARCHAR(30),"
+ "\n\tlname VARCHAR(30),"
+ "\n\thired DATE not null default '1970-01-01',"
+ "\n\tseparated DATE not null default '9999-12-31',"
+ "\n\tjob_code INT,"
+ "\n\tstore_id INT"
+ "\n)"
+ "\npartition by range (YEAR(separated))"
@@ -41,7 +41,7 @@ public class OceanbaseCreateTableTest_rangePartition5 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE tnrange ("
+ "\n\tid INT, "
+ "\n\tid INT,"
+ "\n\tname VARCHAR(5)"
+ "\n)"
+ "\nPARTITION BY RANGE (id)"
@@ -54,7 +54,7 @@ public class OceanbaseCreateTableTest_rangePartition5 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table tnrange ("
+ "\n\tid INT, "
+ "\n\tid INT,"
+ "\n\tname VARCHAR(5)"
+ "\n)"
+ "\npartition by range (id)"
@@ -43,7 +43,7 @@ public class OceanbaseCreateTableTest_subPartition extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE ts ("
+ "\n\tid INT, "
+ "\n\tid INT,"
+ "\n\tpurchased DATE"
+ "\n)"
+ "\nPARTITION BY RANGE (YEAR(purchased))"
@@ -58,7 +58,7 @@ public class OceanbaseCreateTableTest_subPartition extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table ts ("
+ "\n\tid INT, "
+ "\n\tid INT,"
+ "\n\tpurchased DATE"
+ "\n)"
+ "\npartition by range (YEAR(purchased))"
@@ -45,7 +45,7 @@ public class OceanbaseCreateTableTest_subPartition2 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE ts (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tpurchased DATE" + //
"\n)" + //
"\nPARTITION BY RANGE (YEAR(purchased))" + //
@@ -72,7 +72,7 @@ public class OceanbaseCreateTableTest_subPartition2 extends MysqlTest {
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table ts (" + //
"\n\tid INT, " + //
"\n\tid INT," + //
"\n\tpurchased DATE" + //
"\n)" + //
"\npartition by range (YEAR(purchased))" + //
@@ -40,7 +40,7 @@ public class OceanbaseCreateTableTest_subPartition3 extends MysqlTest {
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE ts ("
+ "\n\tid INT, "
+ "\n\tid INT,"
+ "\n\tpurchased DATE"
+ "\n)"
+ "\nPARTITION BY RANGE (YEAR(purchased))"
@@ -41,7 +41,7 @@ public class OceanbaseCreateTableTest_subPartition4 extends MysqlTest {
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE ts ("
+ "\n\tid INT, "
+ "\n\tid INT,"
+ "\n\tpurchased DATE"
+ "\n)"
+ "\nPARTITION BY RANGE (YEAR(purchased))"