提交 19ecb483 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Forbid reconnects in non-regular modes in TestScript

上级 a9f52ea6
......@@ -43,6 +43,8 @@ import org.h2.engine.Mode;
import org.h2.engine.SessionInterface;
import org.h2.engine.SessionRemote;
import org.h2.engine.SysProperties;
import org.h2.engine.Mode.ModeEnum;
import org.h2.engine.Session;
import org.h2.message.DbException;
import org.h2.message.TraceObject;
import org.h2.result.ResultInterface;
......@@ -2121,4 +2123,12 @@ public class JdbcConnection extends TraceObject
return mode;
}
/**
* INTERNAL
*/
public boolean isRegularMode() throws SQLException {
// Clear cached mode if any (required by tests)
mode = null;
return getMode().getEnum() == ModeEnum.REGULAR;
}
}
......@@ -26,6 +26,7 @@ import java.util.Random;
import org.h2.api.ErrorCode;
import org.h2.engine.SysProperties;
import org.h2.jdbc.JdbcConnection;
import org.h2.test.TestAll;
import org.h2.test.TestBase;
import org.h2.util.StringUtils;
......@@ -298,7 +299,7 @@ public class TestScript extends TestBase {
private void process(String sql) throws Exception {
if (reconnectOften) {
if (!containsTempTables()) {
if (!containsTempTables() && ((JdbcConnection) conn).isRegularMode()) {
boolean autocommit = conn.getAutoCommit();
if (autocommit && random.nextInt(10) < 1) {
// reconnect 10% of the time
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论