improved sql parser.

This commit is contained in:
wenshao
2017-08-01 19:05:31 +08:00
parent c2adc8bfd4
commit 544da04ee4
32 changed files with 489 additions and 4 deletions
@@ -276,7 +276,7 @@ public class MySqlCreateTable_showColumns_repository_test extends MysqlTest {
"\t`c_mediumtext` mediumtext COMMENT 'mediumtext',\n" +
"\t`c_longblob` longblob COMMENT 'longblob',\n" +
"\tKEY `k_c` (`c_tinyint`, `c_int`)\n" +
") ENGINE = InnoDB AUTO_INCREMENT = 1769503 CHARSET = utf8mb4 COMMENT = '10000000'", createTableStmt.toString());
") ENGINE = InnoDB AUTO_INCREMENT = 1769503 CHARSET = utf8mb4 COMMENT = '10000000'", repository.console("show create table test1"));
assertEquals("+--------------+--------------+------+-----+---------------------+-----------------------------+\n" +
"| Field | Type | Null | Key | Default | Extra |\n" +
@@ -299,5 +299,28 @@ public class MySqlCreateTable_showColumns_repository_test extends MysqlTest {
"| c_mediumtext | mediumtext | NO | | NULL | |\n" +
"| c_longblob | longblob | NO | | NULL | |\n" +
"+--------------+--------------+------+-----+---------------------+-----------------------------+\n", repository.console("show columns from test1"));
repository.console("CREATE TABLE test2 like test1");
assertEquals("CREATE TABLE test2 (\n" +
"\tc_decimal_1 INT(11) NOT NULL DEFAULT NULL,\n" +
"\t`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',\n" +
"\t`c_tinyint` tinyint(4) DEFAULT '1' COMMENT 'tinyint',\n" +
"\t`c_smallint` smallint(6) DEFAULT 0 COMMENT 'smallint',\n" +
"\t`c_mediumint` mediumint(9) DEFAULT NULL COMMENT 'mediumint',\n" +
"\t`c_int` int(11) DEFAULT NULL COMMENT 'int',\n" +
"\t`c_bigint` bigint(20) DEFAULT NULL COMMENT 'bigint',\n" +
"\t`c_date` date DEFAULT '0000-00-00' COMMENT 'date',\n" +
"\t`c_datetime` datetime DEFAULT '0000-00-00 00:00:00' COMMENT 'datetime',\n" +
"\t`c_timestamp` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'timestamp',\n" +
"\t`c_time` time DEFAULT NULL COMMENT 'time',\n" +
"\t`c_char` char(10) DEFAULT NULL COMMENT 'char',\n" +
"\t`c_varchar` varchar(10) DEFAULT 'hello' COMMENT 'varchar',\n" +
"\t`c_blob` blob COMMENT 'blob',\n" +
"\t`c_text` text COMMENT 'text',\n" +
"\t`c_mediumtext` mediumtext COMMENT 'mediumtext',\n" +
"\t`c_longblob` longblob COMMENT 'longblob',\n" +
"\tKEY `k_c` (`c_tinyint`, `c_int`)\n" +
") ENGINE = InnoDB AUTO_INCREMENT = 1769503 CHARSET = utf8mb4 COMMENT = '10000000'", repository.console("show create table test2"));
}
}