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) {
124124 @ Override
125125 public String toString () {
126126 String sql = "" ;
127+ String createOps = PlainSelect .getStringList (createOptionsStrings , false , false );
127128
128- sql = "CREATE " + (unlogged ? "UNLOGGED " : "" ) + "TABLE " + table ;
129+ sql = "CREATE " + (unlogged ? "UNLOGGED " : "" ) +
130+ (!"" .equals (createOps )?createOps + " " :"" ) +
131+ "TABLE " + table ;
129132
130133 if (select != null ) {
131134 sql += " AS " + select .toString ();
Original file line number Diff line number Diff line change 2626import net .sf .jsqlparser .statement .create .table .ColumnDefinition ;
2727import net .sf .jsqlparser .statement .create .table .CreateTable ;
2828import net .sf .jsqlparser .statement .create .table .Index ;
29+ import net .sf .jsqlparser .statement .select .PlainSelect ;
2930
3031/**
3132 * A class to de-parse (that is, tranform from JSqlParser hierarchy into a
@@ -47,7 +48,11 @@ public void deParse(CreateTable createTable) {
4748 if (createTable .isUnlogged ()) {
4849 buffer .append ("UNLOGGED " );
4950 }
50- if (createTable .)
51+ String params = PlainSelect .getStringList (createTable .getCreateOptionsStrings (), false , false );
52+ if (!"" .equals (params )) {
53+ buffer .append (params ).append (' ' );
54+ }
55+
5156 buffer .append ("TABLE " ).append (createTable .getTable ().getFullyQualifiedName ());
5257 if (createTable .getSelect () != null ) {
5358 buffer .append (" AS " ).append (createTable .getSelect ().toString ());
@@ -82,6 +87,11 @@ public void deParse(CreateTable createTable) {
8287 buffer .append (")" );
8388 }
8489 }
90+
91+ params = PlainSelect .getStringList (createTable .getTableOptionsStrings (), false , false );
92+ if (!"" .equals (params )) {
93+ buffer .append (' ' ).append (params );
94+ }
8595 }
8696
8797 public StringBuilder getBuffer () {
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ public void testCreateTablePrimaryKey() throws JSQLParserException {
9393 }
9494
9595 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" );
9797 }
9898
9999 public void testRUBiSCreateList () throws Exception {
You can’t perform that action at this time.
0 commit comments