提交 ff25a9ff authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 c0354f2a
...@@ -16,7 +16,8 @@ Change Log ...@@ -16,7 +16,8 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>Timestamp columns such as TIMESTAMP(6) were not compatible to other database. <ul><li>When using remote in-memory databases, large LOB objects did not work.
</li><li>Timestamp columns such as TIMESTAMP(6) were not compatible to other database.
</li><li>Opening a large database was slow if there was a problem opening the previous time. </li><li>Opening a large database was slow if there was a problem opening the previous time.
</li><li>NOT IN(SELECT ...) was incorrect if the subquery returns no rows. </li><li>NOT IN(SELECT ...) was incorrect if the subquery returns no rows.
</li><li>CREATE TABLE AS SELECT did not work correctly in the multi-version concurrency mode. </li><li>CREATE TABLE AS SELECT did not work correctly in the multi-version concurrency mode.
......
...@@ -19,6 +19,7 @@ import org.h2.result.LocalResult; ...@@ -19,6 +19,7 @@ import org.h2.result.LocalResult;
import org.h2.util.ObjectArray; import org.h2.util.ObjectArray;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
import org.h2.value.Value; import org.h2.value.Value;
import org.h2.value.ValueLob;
/** /**
* A prepared statement. * A prepared statement.
...@@ -320,15 +321,29 @@ public abstract class Prepared { ...@@ -320,15 +321,29 @@ public abstract class Prepared {
Expression e = (Expression) parameters.get(i); Expression e = (Expression) parameters.get(i);
Value v = e.getValue(session); Value v = e.getValue(session);
try { try {
// if (v.getPrecision() > SysProperties.MAX_TRACE_DATA_LENGTH) { if (v.getPrecision() > SysProperties.MAX_TRACE_DATA_LENGTH) {
// if (v.getType() == Value.CLOB) {
// } ValueLob lob = (ValueLob) v;
String s = v.getSQL(); buff.append("SPACE(");
int test; buff.append(lob.getPrecision());
// if (s.length() > SysProperties.MAX_TRACE_DATA_LENGTH) { buff.append(")");
// s = s.substring(0, SysProperties.MAX_TRACE_DATA_LENGTH) + " /* len: " + s.length() + " */"; buff.append("/* ");
// } buff.append(lob.getObjectId());
buff.append(s); buff.append("*/");
} else if (v.getType() == Value.BLOB) {
ValueLob lob = (ValueLob) v;
buff.append("CAST(REPEAT('00', ");
buff.append(lob.getPrecision());
buff.append(") AS BINARY)");
buff.append("/* ");
buff.append(lob.getObjectId());
buff.append("*/");
} else {
buff.append(v.getSQL());
}
} else {
buff.append(v.getSQL());
}
} catch (Exception t) { } catch (Exception t) {
buff.append("? /*"); buff.append("? /*");
buff.append(StringUtils.quoteJavaString(t.getMessage())); buff.append(StringUtils.quoteJavaString(t.getMessage()));
......
...@@ -259,6 +259,12 @@ public class SysProperties { ...@@ -259,6 +259,12 @@ public class SysProperties {
*/ */
public static final int MAX_QUERY_TIMEOUT = getIntSetting(H2_MAX_QUERY_TIMEOUT, 0); public static final int MAX_QUERY_TIMEOUT = getIntSetting(H2_MAX_QUERY_TIMEOUT, 0);
/**
* System property <code>h2.maxTraceDataLength</code> (default: 65535).<br />
* The maximum size of a LOB value that is written as data to the trace system.
*/
public static final long MAX_TRACE_DATA_LENGTH = getIntSetting("h2.maxTraceDataLength", 65535);
/** /**
* System property <code>h2.minColumnNameMap</code> (default: 3).<br /> * System property <code>h2.minColumnNameMap</code> (default: 3).<br />
* The minimum number of columns where a hash table is created when result set * The minimum number of columns where a hash table is created when result set
......
...@@ -454,8 +454,6 @@ public class SessionRemote implements SessionInterface, DataHandler { ...@@ -454,8 +454,6 @@ public class SessionRemote implements SessionInterface, DataHandler {
public String createTempFile() throws SQLException { public String createTempFile() throws SQLException {
try { try {
String prefix = getFilePrefix(System.getProperty("java.io.tmpdir")); String prefix = getFilePrefix(System.getProperty("java.io.tmpdir"));
int test;
// return FileUtils.createTempFile(databaseName, Constants.SUFFIX_TEMP_FILE, true, false);
return FileUtils.createTempFile(prefix, Constants.SUFFIX_TEMP_FILE, true, false); return FileUtils.createTempFile(prefix, Constants.SUFFIX_TEMP_FILE, true, false);
} catch (IOException e) { } catch (IOException e) {
throw Message.convertIOException(e, databaseName); throw Message.convertIOException(e, databaseName);
......
...@@ -654,7 +654,6 @@ public class ValueLob extends Value { ...@@ -654,7 +654,6 @@ public class ValueLob extends Value {
} }
public String toString() { public String toString() {
int tst;
if (small == null) { if (small == null) {
return getClass().getName() + " file: " + fileName + " type: " + type + " precision: " + precision; return getClass().getName() + " file: " + fileName + " type: " + type + " precision: " + precision;
} }
......
...@@ -154,7 +154,7 @@ public abstract class TestBase { ...@@ -154,7 +154,7 @@ public abstract class TestBase {
return name; return name;
} }
if (config.memory) { if (config.memory) {
url = "mem:" + name; name = "mem:" + name;
} else { } else {
if (!name.startsWith("memFS:") && !name.startsWith(baseDir + "/")) { if (!name.startsWith("memFS:") && !name.startsWith(baseDir + "/")) {
name = baseDir + "/" + name; name = baseDir + "/" + name;
...@@ -162,6 +162,7 @@ public abstract class TestBase { ...@@ -162,6 +162,7 @@ public abstract class TestBase {
if (config.deleteIndex) { if (config.deleteIndex) {
deleteIndexFiles(name); deleteIndexFiles(name);
} }
}
if (config.networked) { if (config.networked) {
if (config.ssl) { if (config.ssl) {
url = "ssl://localhost:9192/" + name; url = "ssl://localhost:9192/" + name;
...@@ -171,28 +172,29 @@ public abstract class TestBase { ...@@ -171,28 +172,29 @@ public abstract class TestBase {
} else { } else {
url = name; url = name;
} }
if (!config.memory) {
if (config.textStorage) {
url += ";STORAGE=TEXT";
}
if (admin) {
url += ";LOG=" + config.logMode;
}
if (config.smallLog && admin) {
url += ";MAX_LOG_SIZE=1";
}
}
if (config.traceSystemOut) { if (config.traceSystemOut) {
url += ";TRACE_LEVEL_SYSTEM_OUT=2"; url += ";TRACE_LEVEL_SYSTEM_OUT=2";
} }
if (config.traceLevelFile > 0 && admin) { if (config.traceLevelFile > 0 && admin) {
url += ";TRACE_LEVEL_FILE=" + config.traceLevelFile; url += ";TRACE_LEVEL_FILE=" + config.traceLevelFile;
} }
}
if (config.throttle > 0) { if (config.throttle > 0) {
url += ";THROTTLE=" + config.throttle; url += ";THROTTLE=" + config.throttle;
} }
if (config.textStorage) {
url += ";STORAGE=TEXT";
}
if (url.indexOf("LOCK_TIMEOUT=") < 0) { if (url.indexOf("LOCK_TIMEOUT=") < 0) {
url += ";LOCK_TIMEOUT=50"; url += ";LOCK_TIMEOUT=50";
} }
if (admin) {
url += ";LOG=" + config.logMode;
}
if (config.smallLog && admin) {
url += ";MAX_LOG_SIZE=1";
}
if (config.diskUndo && admin) { if (config.diskUndo && admin) {
url += ";MAX_MEMORY_UNDO=3"; url += ";MAX_MEMORY_UNDO=3";
} }
......
...@@ -35,6 +35,7 @@ import org.h2.util.StringUtils; ...@@ -35,6 +35,7 @@ import org.h2.util.StringUtils;
public class TestLob extends TestBase { public class TestLob extends TestBase {
public void test() throws Exception { public void test() throws Exception {
testLobServerMemory();
if (config.memory) { if (config.memory) {
return; return;
} }
...@@ -60,6 +61,18 @@ public class TestLob extends TestBase { ...@@ -60,6 +61,18 @@ public class TestLob extends TestBase {
testJavaObject(); testJavaObject();
} }
private void testLobServerMemory() throws Exception {
deleteDb("lob");
Connection conn = getConnection("lob;TRACE_LEVEL_FILE=3");
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST(ID INT, DATA CLOB)");
PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST VALUES(1, ?)");
StringReader reader = new StringReader(new String(new char[100000]));
prep.setClob(1, reader);
prep.execute();
conn.close();
}
private void testLobDelete() throws Exception { private void testLobDelete() throws Exception {
if (config.memory) { if (config.memory) {
return; return;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论