提交 9a2b7e25 authored 作者: Thomas Mueller's avatar Thomas Mueller

The SQL script generated by the "script" command contained inconsistent newlines on Windows.

上级 33305d81
...@@ -18,7 +18,9 @@ Change Log ...@@ -18,7 +18,9 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>When using trace level 4 (SLF4J) in the server mode, a directory "trace.db" <ul><li>The SQL script generated by the "script" command contained
inconsistent newlines on Windows.
</li><li>When using trace level 4 (SLF4J) in the server mode, a directory "trace.db"
and an empty file was created on the client side. This is no longer made. and an empty file was created on the client side. This is no longer made.
</li><li>Optimize IN(...) queries: there was a bug in version 1.3.170 </li><li>Optimize IN(...) queries: there was a bug in version 1.3.170
if the type of the left hand side didn't match the type of the right hand side. Fixed. if the type of the left hand side didn't match the type of the right hand side. Fixed.
......
...@@ -77,6 +77,7 @@ public class ScriptCommand extends ScriptBase { ...@@ -77,6 +77,7 @@ public class ScriptCommand extends ScriptBase {
private boolean drop; private boolean drop;
private boolean simple; private boolean simple;
private LocalResult result; private LocalResult result;
private String lineSeparatorString;
private byte[] lineSeparator; private byte[] lineSeparator;
private byte[] buffer; private byte[] buffer;
private boolean tempLobTableCreated; private boolean tempLobTableCreated;
...@@ -625,7 +626,8 @@ public class ScriptCommand extends ScriptBase { ...@@ -625,7 +626,8 @@ public class ScriptCommand extends ScriptBase {
result = null; result = null;
buffer = null; buffer = null;
try { try {
lineSeparator = SysProperties.LINE_SEPARATOR.getBytes(charset); lineSeparatorString = SysProperties.LINE_SEPARATOR;
lineSeparator = lineSeparatorString.getBytes(charset);
} catch (IOException e) { } catch (IOException e) {
throw DbException.convertIOException(e, null); throw DbException.convertIOException(e, null);
} }
...@@ -655,6 +657,9 @@ public class ScriptCommand extends ScriptBase { ...@@ -655,6 +657,9 @@ public class ScriptCommand extends ScriptBase {
if (s == null) { if (s == null) {
return; return;
} }
if (lineSeparator.length > 1 || lineSeparator[0] != '\n') {
s = StringUtils.replaceAll(s, "\n", lineSeparatorString);
}
s += ";"; s += ";";
if (out != null) { if (out != null) {
byte[] buff = s.getBytes(charset); byte[] buff = s.getBytes(charset);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论