提交 6b50d0da authored 作者: Thomas Mueller's avatar Thomas Mueller

CSV tool: the rowSeparator option is no longer supported, as the same can be…

CSV tool: the rowSeparator option is no longer supported, as the same can be achieved with the lineSeparator.
上级 f1c6e166
...@@ -1846,14 +1846,12 @@ The following options are supported: ...@@ -1846,14 +1846,12 @@ The following options are supported:
""lineComment"" (disabled by default), ""lineComment"" (disabled by default),
""lineSeparator"", ""lineSeparator"" (the line separator used for writing; ignored for reading),
""null"", Note that an empty value is always treated as null. ""null"", Note that an empty value is always treated as null.
This feature for compatibility, it is only here to support reading existing CSV files This feature for compatibility, it is only here to support reading existing CSV files
that contain explicit ""null"" delimiters. that contain explicit ""null"" delimiters.
""rowSeparator"" (not set by default),
""preserveWhitespace"" (true or false; disabled by default), ""preserveWhitespace"" (true or false; disabled by default),
""writeColumnHeader"" (true or false; enabled by default). ""writeColumnHeader"" (true or false; enabled by default).
......
...@@ -17,7 +17,9 @@ Change Log ...@@ -17,7 +17,9 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>Descending indexes on MVStore tables did not work properly. <ul><li>CSV tool: the rowSeparator option is no longer supported,
as the same can be achieved with the lineSeparator.
</li><li>Descending indexes on MVStore tables did not work properly.
</li><li>Issue 579: Conditions on the "_rowid_" pseudo-column didn't use an index </li><li>Issue 579: Conditions on the "_rowid_" pseudo-column didn't use an index
when using the MVStore. when using the MVStore.
</li><li>Fixed documentation that "offset" and "fetch" are also keywords since version 1.4.x. </li><li>Fixed documentation that "offset" and "fetch" are also keywords since version 1.4.x.
......
...@@ -57,7 +57,6 @@ public class Csv implements SimpleRowSource { ...@@ -57,7 +57,6 @@ public class Csv implements SimpleRowSource {
private String lineSeparator = SysProperties.LINE_SEPARATOR; private String lineSeparator = SysProperties.LINE_SEPARATOR;
private String nullString = ""; private String nullString = "";
private String rowSeparatorWrite;
private String fileName; private String fileName;
private Reader input; private Reader input;
private char[] inputBuffer; private char[] inputBuffer;
...@@ -290,9 +289,6 @@ public class Csv implements SimpleRowSource { ...@@ -290,9 +289,6 @@ public class Csv implements SimpleRowSource {
output.write(nullString); output.write(nullString);
} }
} }
if (rowSeparatorWrite != null) {
output.write(rowSeparatorWrite);
}
output.write(lineSeparator); output.write(lineSeparator);
} }
...@@ -676,26 +672,6 @@ public class Csv implements SimpleRowSource { ...@@ -676,26 +672,6 @@ public class Csv implements SimpleRowSource {
return fieldSeparatorRead; return fieldSeparatorRead;
} }
/**
* Get the current row separator for writing.
*
* @return the row separator
*/
public String getRowSeparatorWrite() {
return rowSeparatorWrite;
}
/**
* Override the end-of-row marker for writing. The default is null. After
* writing the end-of-row marker, a line feed is written (\n or \r\n
* depending on the system settings).
*
* @param rowSeparatorWrite the row separator
*/
public void setRowSeparatorWrite(String rowSeparatorWrite) {
this.rowSeparatorWrite = rowSeparatorWrite;
}
/** /**
* Set the line comment character. The default is character code 0 (line * Set the line comment character. The default is character code 0 (line
* comments are disabled). * comments are disabled).
...@@ -774,7 +750,10 @@ public class Csv implements SimpleRowSource { ...@@ -774,7 +750,10 @@ public class Csv implements SimpleRowSource {
} }
/** /**
* Set the line separator used for writing. * Set the line separator used for writing. This is usually a line feed (\n
* or \r\n depending on the system settings). The line separator is written
* after each row (including the last row), so this option can include an
* end-of-row marker if needed.
* *
* @param lineSeparator the line separator * @param lineSeparator the line separator
*/ */
...@@ -877,8 +856,6 @@ public class Csv implements SimpleRowSource { ...@@ -877,8 +856,6 @@ public class Csv implements SimpleRowSource {
setLineSeparator(value); setLineSeparator(value);
} else if (isParam(key, "null", "nullString")) { } else if (isParam(key, "null", "nullString")) {
setNullString(value); setNullString(value);
} else if (isParam(key, "rowSeparator", "rowSep")) {
setRowSeparatorWrite(value);
} else if (isParam(key, "charset", "characterSet")) { } else if (isParam(key, "charset", "characterSet")) {
charset = value; charset = value;
} else if (isParam(key, "preserveWhitespace")) { } else if (isParam(key, "preserveWhitespace")) {
......
...@@ -184,7 +184,6 @@ public class TestCsv extends TestBase { ...@@ -184,7 +184,6 @@ public class TestCsv extends TestBase {
assertEquals(",", csv.getFieldSeparatorWrite()); assertEquals(",", csv.getFieldSeparatorWrite());
assertEquals(SysProperties.LINE_SEPARATOR, csv.getLineSeparator()); assertEquals(SysProperties.LINE_SEPARATOR, csv.getLineSeparator());
assertEquals("", csv.getNullString()); assertEquals("", csv.getNullString());
assertEquals(null, csv.getRowSeparatorWrite());
assertEquals('\"', csv.getEscapeCharacter()); assertEquals('\"', csv.getEscapeCharacter());
assertEquals('"', csv.getFieldDelimiter()); assertEquals('"', csv.getFieldDelimiter());
assertEquals(',', csv.getFieldSeparatorRead()); assertEquals(',', csv.getFieldSeparatorRead());
...@@ -207,7 +206,7 @@ public class TestCsv extends TestBase { ...@@ -207,7 +206,7 @@ public class TestCsv extends TestBase {
charset = csv.setOptions("escape=1x fieldDelimiter=2x " + charset = csv.setOptions("escape=1x fieldDelimiter=2x " +
"fieldSeparator=3x " + "lineComment=4x lineSeparator=5x " + "fieldSeparator=3x " + "lineComment=4x lineSeparator=5x " +
"null=6x rowSeparator=7x charset=8x " + "null=6x charset=7x " +
"preserveWhitespace=true caseSensitiveColumnNames=true"); "preserveWhitespace=true caseSensitiveColumnNames=true");
assertEquals('1', csv.getEscapeCharacter()); assertEquals('1', csv.getEscapeCharacter());
assertEquals('2', csv.getFieldDelimiter()); assertEquals('2', csv.getFieldDelimiter());
...@@ -216,14 +215,13 @@ public class TestCsv extends TestBase { ...@@ -216,14 +215,13 @@ public class TestCsv extends TestBase {
assertEquals('4', csv.getLineCommentCharacter()); assertEquals('4', csv.getLineCommentCharacter());
assertEquals("5x", csv.getLineSeparator()); assertEquals("5x", csv.getLineSeparator());
assertEquals("6x", csv.getNullString()); assertEquals("6x", csv.getNullString());
assertEquals("7x", csv.getRowSeparatorWrite()); assertEquals("7x", charset);
assertEquals("8x", charset);
assertTrue(csv.getPreserveWhitespace()); assertTrue(csv.getPreserveWhitespace());
assertTrue(csv.getCaseSensitiveColumnNames()); assertTrue(csv.getCaseSensitiveColumnNames());
charset = csv.setOptions("escape= fieldDelimiter= " + charset = csv.setOptions("escape= fieldDelimiter= " +
"fieldSeparator= " + "lineComment= lineSeparator=\r\n " + "fieldSeparator= " + "lineComment= lineSeparator=\r\n " +
"null=\0 rowSeparator= charset="); "null=\0 charset=");
assertEquals(0, csv.getEscapeCharacter()); assertEquals(0, csv.getEscapeCharacter());
assertEquals(0, csv.getFieldDelimiter()); assertEquals(0, csv.getFieldDelimiter());
assertEquals(0, csv.getFieldSeparatorRead()); assertEquals(0, csv.getFieldSeparatorRead());
...@@ -231,7 +229,6 @@ public class TestCsv extends TestBase { ...@@ -231,7 +229,6 @@ public class TestCsv extends TestBase {
assertEquals(0, csv.getLineCommentCharacter()); assertEquals(0, csv.getLineCommentCharacter());
assertEquals("\r\n", csv.getLineSeparator()); assertEquals("\r\n", csv.getLineSeparator());
assertEquals("\0", csv.getNullString()); assertEquals("\0", csv.getNullString());
assertEquals("", csv.getRowSeparatorWrite());
assertEquals("", charset); assertEquals("", charset);
createClassProxy(Csv.class); createClassProxy(Csv.class);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论