提交 3ae7d1e4 authored 作者: LaughingMan's avatar LaughingMan

Remove useless code.

If the database exists, it gets deleted. If the database doesn't exist, an exception gets thrown, immediately caught, and ignored. In both cases exists will be false and we continue. Later the database
gets deleted unconditionally, which means we can delete this entire block.
上级 12400e6b
...@@ -102,30 +102,6 @@ public class CreateCluster extends Tool { ...@@ -102,30 +102,6 @@ public class CreateCluster extends Tool {
String user, String password, String serverList) throws SQLException { String user, String password, String serverList) throws SQLException {
org.h2.Driver.load(); org.h2.Driver.load();
// verify that the database doesn't exist,
// or if it exists (an old cluster instance), it is deleted
boolean exists = true;
try (Connection connTarget = DriverManager.getConnection(urlTarget +
";IFEXISTS=TRUE;CLUSTER=" + Constants.CLUSTERING_ENABLED,
user, password);
Statement stat = connTarget.createStatement())
{
stat.execute("DROP ALL OBJECTS DELETE FILES");
exists = false;
} catch (SQLException e) {
if (e.getErrorCode() == ErrorCode.DATABASE_NOT_FOUND_1) {
// database does not exists yet - ok
exists = false;
} else {
throw e;
}
}
if (exists) {
throw new SQLException(
"Target database must not yet exist. Please delete it first: " +
urlTarget);
}
try (Connection connSource = DriverManager.getConnection( try (Connection connSource = DriverManager.getConnection(
// use cluster='' so connecting is possible // use cluster='' so connecting is possible
// even if the cluster is enabled // even if the cluster is enabled
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论