Skip to content

Commit c658f4d

Browse files
author
Stefan Steinhauser
committed
test: Fix EXPORT unit tests
1 parent 34791cf commit c658f4d

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/main/java/net/sf/jsqlparser/statement/CSVColumn.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ public String toString() {
7878
if (format != null) {
7979
sql.append(" FORMAT = ");
8080
sql.append(format);
81-
} else {
81+
}
82+
83+
if (delimit != null) {
8284
sql.append(" DELIMIT = ");
8385
sql.append(delimit);
8486
}

src/main/java/net/sf/jsqlparser/statement/export/DBMSTableDestinationOption.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public String toString() {
5656

5757
sql.append(key);
5858
if (value != null) {
59+
sql.append(" ");
5960
sql.append(value);
6061
}
6162

src/test/java/net/sf/jsqlparser/statement/export/ExportTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public void testExportIntoFileCSV(String sqlStr) throws JSQLParserException {
5050
"EXPORT schemaName.tableName INTO LOCAL CSV FILE 'file.csv' ( 1 DELIMIT = ALWAYS )",
5151
"EXPORT schemaName.tableName INTO LOCAL CSV FILE 'file.csv' ( 1 DELIMIT = NEVER )",
5252
"EXPORT schemaName.tableName INTO LOCAL CSV FILE 'file.csv' ( 1 DELIMIT = AUTO )",
53-
"EXPORT schemaName.tableName INTO LOCAL CSV FILE 'file.csv' ( 1 FORMAT = 'format', 2 FORMAT = 'format', DELIMIT = ALWAYS )",
53+
"EXPORT schemaName.tableName INTO LOCAL CSV FILE 'file.csv' ( 1 FORMAT = 'format', 2 DELIMIT = NEVER )",
54+
"EXPORT schemaName.tableName INTO LOCAL CSV FILE 'file.csv' ( 1 FORMAT = 'format', 2 DELIMIT = NEVER, 3 FORMAT = 'format' DELIMIT = ALWAYS )",
5455
"EXPORT schemaName.tableName INTO LOCAL CSV FILE 'file.csv' ( 1 .. 2 )",
5556
"EXPORT schemaName.tableName INTO LOCAL CSV FILE 'file.csv' ( 1, 1 .. 2 )",
5657
"EXPORT schemaName.tableName INTO LOCAL CSV FILE 'file.csv' ( 1, 1 .. 2, 3 )"
@@ -77,11 +78,11 @@ public void testExportIntoFileFBV(String sqlStr) throws JSQLParserException {
7778
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( FORMAT = 'format' )",
7879
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( ALIGN = LEFT )",
7980
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( ALIGN = RIGHT )",
80-
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( PADDING = 'padding' )",
81+
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( PADDING = '0' )",
8182

82-
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( SIZE = 1, START = 1 )",
83-
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( SIZE = 1 START = 1 )",
84-
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( SIZE = 1 START = 1, FORMAT = 'format' )"
83+
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( SIZE = 1, PADDING = '0' )",
84+
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( SIZE = 1 PADDING = '0' )",
85+
"EXPORT schemaName.tableName INTO LOCAL FBV FILE 'file.fbv' ( SIZE = 1 PADDING = '0', FORMAT = 'format' )"
8586
})
8687
public void testExportIntoFileFBVCols(String sqlStr) throws JSQLParserException {
8788
TestUtils.assertSqlCanBeParsedAndDeparsed(sqlStr);

0 commit comments

Comments
 (0)