Skip to content

Commit 86ea601

Browse files
committed
fixes #770
1 parent f958fa7 commit 86ea601

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,6 +3696,8 @@ List<String> CreateParameter():
36963696
tk=<K_TYPE> { param.add(tk.image); }
36973697
|
36983698
tk=<K_COMMENT> { param.add(tk.image); }
3699+
|
3700+
tk=<K_USING> { param.add(tk.image); }
36993701
)
37003702
{return param;}
37013703
}

src/test/java/net/sf/jsqlparser/statement/create/CreateTableTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,12 @@ public void testMySqlCreateTableWithTextIndexes() throws JSQLParserException {
238238
public void testCreateTableWithCheck() throws JSQLParserException {
239239
assertSqlCanBeParsedAndDeparsed("CREATE TABLE table2 (id INT (10) NOT NULL, name TEXT, url TEXT, CONSTRAINT name_not_empty CHECK (name <> ''))");
240240
}
241+
241242
@Test
242243
public void testCreateTableWithCheckNotNull() throws JSQLParserException {
243244
assertSqlCanBeParsedAndDeparsed("CREATE TABLE table2 (id INT (10) NOT NULL, name TEXT, url TEXT, CONSTRAINT name_not_null CHECK (name IS NOT NULL))");
244245
}
246+
245247
@Test
246248
public void testCreateTableIssue270() throws JSQLParserException {
247249
assertSqlCanBeParsedAndDeparsed("CREATE TABLE item (i_item_sk integer NOT NULL, i_item_id character (16) NOT NULL, i_rec_start_date date, i_rec_end_date date, i_item_desc character varying(200), i_current_price numeric(7,2), i_wholesale_cost numeric(7,2), i_brand_id integer, i_brand character(50), i_class_id integer, i_class character(50), i_category_id integer, i_category character(50), i_manufact_id integer, i_manufact character(50), i_size character(20), i_formulation character(20), i_color character(20), i_units character(10), i_container character(10), i_manager_id integer, i_product_name character(50) )", true);
@@ -357,6 +359,11 @@ public void testIssue661Partition() throws JSQLParserException {
357359
assertSqlCanBeParsedAndDeparsed("CREATE TABLE T_TEST_PARTITION (PART_COLUMN VARCHAR2 (32) NOT NULL, OTHER_COLS VARCHAR2 (10) NOT NULL) TABLESPACE TBS_DATA_01 PARTITION BY HASH (PART_COLUMN) PARTITIONS 4 STORE IN (TBS_DATA_01) COMPRESS");
358360
}
359361

362+
@Test
363+
public void testIssue770Using() throws JSQLParserException {
364+
assertSqlCanBeParsedAndDeparsed("CREATE TABLE `department_region` (`ID` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `DEPARTMENT_ID` int(10) unsigned NOT NULL COMMENT '部门ID', PRIMARY KEY (`ID`) KEY `DISTRICT_CODE` (`DISTRICT_CODE`) USING BTREE) ENGINE=InnoDB AUTO_INCREMENT=420 DEFAULT CHARSET=utf8", true);
365+
}
366+
360367
@Test
361368
public void testRUBiSCreateList() throws Exception {
362369
BufferedReader in = new BufferedReader(new InputStreamReader(CreateTableTest.class.

0 commit comments

Comments
 (0)