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

--no commit message

--no commit message
上级 c0354f2a
......@@ -16,7 +16,8 @@ Change Log
<h1>Change Log</h1>
<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>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.
......
......@@ -19,6 +19,7 @@ import org.h2.result.LocalResult;
import org.h2.util.ObjectArray;
import org.h2.util.StringUtils;
import org.h2.value.Value;
import org.h2.value.ValueLob;
/**
* A prepared statement.
......@@ -320,15 +321,29 @@ public abstract class Prepared {
Expression e = (Expression) parameters.get(i);
Value v = e.getValue(session);
try {
// if (v.getPrecision() > SysProperties.MAX_TRACE_DATA_LENGTH) {
//
// }
String s = v.getSQL();
int test;
// if (s.length() > SysProperties.MAX_TRACE_DATA_LENGTH) {
// s = s.substring(0, SysProperties.MAX_TRACE_DATA_LENGTH) + " /* len: " + s.length() + " */";
// }
buff.append(s);
if (v.getPrecision() > SysProperties.MAX_TRACE_DATA_LENGTH) {
if (v.getType() == Value.CLOB) {
ValueLob lob = (ValueLob) v;
buff.append("SPACE(");
buff.append(lob.getPrecision());
buff.append(")");
buff.append("/* ");
buff.append(lob.getObjectId());
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) {
buff.append("? /*");
buff.append(StringUtils.quoteJavaString(t.getMessage()));
......
......@@ -259,6 +259,12 @@ public class SysProperties {
*/
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 />
* The minimum number of columns where a hash table is created when result set
......
......@@ -454,8 +454,6 @@ public class SessionRemote implements SessionInterface, DataHandler {
public String createTempFile() throws SQLException {
try {
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);
} catch (IOException e) {
throw Message.convertIOException(e, databaseName);
......
......@@ -654,7 +654,6 @@ public class ValueLob extends Value {
}
public String toString() {
int tst;
if (small == null) {
return getClass().getName() + " file: " + fileName + " type: " + type + " precision: " + precision;
}
......
......@@ -154,7 +154,7 @@ public abstract class TestBase {
return name;
}
if (config.memory) {
url = "mem:" + name;
name = "mem:" + name;
} else {
if (!name.startsWith("memFS:") && !name.startsWith(baseDir + "/")) {
name = baseDir + "/" + name;
......@@ -162,37 +162,39 @@ public abstract class TestBase {
if (config.deleteIndex) {
deleteIndexFiles(name);
}
if (config.networked) {
if (config.ssl) {
url = "ssl://localhost:9192/" + name;
} else {
url = "tcp://localhost:9192/" + name;
}
}
if (config.networked) {
if (config.ssl) {
url = "ssl://localhost:9192/" + name;
} else {
url = name;
url = "tcp://localhost:9192/" + name;
}
} else {
url = name;
}
if (!config.memory) {
if (config.textStorage) {
url += ";STORAGE=TEXT";
}
if (config.traceSystemOut) {
url += ";TRACE_LEVEL_SYSTEM_OUT=2";
if (admin) {
url += ";LOG=" + config.logMode;
}
if (config.traceLevelFile > 0 && admin) {
url += ";TRACE_LEVEL_FILE=" + config.traceLevelFile;
if (config.smallLog && admin) {
url += ";MAX_LOG_SIZE=1";
}
}
if (config.traceSystemOut) {
url += ";TRACE_LEVEL_SYSTEM_OUT=2";
}
if (config.traceLevelFile > 0 && admin) {
url += ";TRACE_LEVEL_FILE=" + config.traceLevelFile;
}
if (config.throttle > 0) {
url += ";THROTTLE=" + config.throttle;
}
if (config.textStorage) {
url += ";STORAGE=TEXT";
}
if (url.indexOf("LOCK_TIMEOUT=") < 0) {
url += ";LOCK_TIMEOUT=50";
}
if (admin) {
url += ";LOG=" + config.logMode;
}
if (config.smallLog && admin) {
url += ";MAX_LOG_SIZE=1";
}
if (config.diskUndo && admin) {
url += ";MAX_MEMORY_UNDO=3";
}
......
......@@ -35,6 +35,7 @@ import org.h2.util.StringUtils;
public class TestLob extends TestBase {
public void test() throws Exception {
testLobServerMemory();
if (config.memory) {
return;
}
......@@ -60,6 +61,18 @@ public class TestLob extends TestBase {
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 {
if (config.memory) {
return;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论