File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed
main/java/net/sf/jsqlparser
test/java/net/sf/jsqlparser/test/create Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -124,8 +124,11 @@ public void setSelect(Select select) {
124
124
@ Override
125
125
public String toString () {
126
126
String sql = "" ;
127
+ String createOps = PlainSelect .getStringList (createOptionsStrings , false , false );
127
128
128
- sql = "CREATE " + (unlogged ? "UNLOGGED " : "" ) + "TABLE " + table ;
129
+ sql = "CREATE " + (unlogged ? "UNLOGGED " : "" ) +
130
+ (!"" .equals (createOps )?createOps + " " :"" ) +
131
+ "TABLE " + table ;
129
132
130
133
if (select != null ) {
131
134
sql += " AS " + select .toString ();
Original file line number Diff line number Diff line change 26
26
import net .sf .jsqlparser .statement .create .table .ColumnDefinition ;
27
27
import net .sf .jsqlparser .statement .create .table .CreateTable ;
28
28
import net .sf .jsqlparser .statement .create .table .Index ;
29
+ import net .sf .jsqlparser .statement .select .PlainSelect ;
29
30
30
31
/**
31
32
* A class to de-parse (that is, tranform from JSqlParser hierarchy into a
@@ -47,7 +48,11 @@ public void deParse(CreateTable createTable) {
47
48
if (createTable .isUnlogged ()) {
48
49
buffer .append ("UNLOGGED " );
49
50
}
50
- if (createTable .)
51
+ String params = PlainSelect .getStringList (createTable .getCreateOptionsStrings (), false , false );
52
+ if (!"" .equals (params )) {
53
+ buffer .append (params ).append (' ' );
54
+ }
55
+
51
56
buffer .append ("TABLE " ).append (createTable .getTable ().getFullyQualifiedName ());
52
57
if (createTable .getSelect () != null ) {
53
58
buffer .append (" AS " ).append (createTable .getSelect ().toString ());
@@ -82,6 +87,11 @@ public void deParse(CreateTable createTable) {
82
87
buffer .append (")" );
83
88
}
84
89
}
90
+
91
+ params = PlainSelect .getStringList (createTable .getTableOptionsStrings (), false , false );
92
+ if (!"" .equals (params )) {
93
+ buffer .append (' ' ).append (params );
94
+ }
85
95
}
86
96
87
97
public StringBuilder getBuffer () {
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ public void testCreateTablePrimaryKey() throws JSQLParserException {
93
93
}
94
94
95
95
public void testCreateTableParams () throws JSQLParserException {
96
- assertSqlCanBeParsedAndDeparsed ("CREATE TEMPORARY TABLE T1(PROCESSID VARCHAR(32)) ON COMMIT PRESERVE ROWS" );
96
+ assertSqlCanBeParsedAndDeparsed ("CREATE TEMPORARY TABLE T1 (PROCESSID VARCHAR (32)) ON COMMIT PRESERVE ROWS" );
97
97
}
98
98
99
99
public void testRUBiSCreateList () throws Exception {
You can’t perform that action at this time.
0 commit comments