mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge pull request #3801 from Dagon0577/fix#3561
Fix bug: MySQL解析national关键字 #3561
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
package com.alibaba.druid.bvt.sql.mysql.createTable;
|
||||
|
||||
import com.alibaba.druid.sql.MysqlTest;
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Dagon0577
|
||||
* @date 2020/5/14 10:51
|
||||
*/
|
||||
public class MySqlCreateTableTest135 extends MysqlTest {
|
||||
public void test_0() throws Exception {
|
||||
String sql =
|
||||
"create table MQ_TOPIC_RECORD(\n"
|
||||
+ " TOPIC_ID bigint(11) not null,\n"
|
||||
+ " BROKENNAME national VARCHAR(50),\n"
|
||||
+ " BROKENNAME2 national CHAR(50)\n" + ");";
|
||||
|
||||
MySqlStatementParser parser = new MySqlStatementParser(sql);
|
||||
List<SQLStatement> statementList = parser.parseStatementList();
|
||||
MySqlCreateTableStatement stmt = (MySqlCreateTableStatement) statementList.get(0);
|
||||
|
||||
assertEquals(1, statementList.size());
|
||||
|
||||
|
||||
assertEquals("CREATE TABLE MQ_TOPIC_RECORD (\n"
|
||||
+ "\tTOPIC_ID bigint(11) NOT NULL,\n"
|
||||
+ "\tBROKENNAME nvarchar(50),\n"
|
||||
+ "\tBROKENNAME2 nchar(50)\n"
|
||||
+ ");", stmt.toString());
|
||||
|
||||
assertEquals("create table MQ_TOPIC_RECORD (\n"
|
||||
+ "\tTOPIC_ID bigint(11) not null,\n"
|
||||
+ "\tBROKENNAME nvarchar(50),\n"
|
||||
+ "\tBROKENNAME2 nchar(50)\n" + ");", stmt.toLowerCaseString());
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user