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

When creating a database from a recovery script, the same user can now be used…

When creating a database from a recovery script, the same user can now be used (CREATE USER now always includes IF EXISTS).
上级 2e80129d
...@@ -201,13 +201,12 @@ public class TestRunscript extends TestBase implements Trigger { ...@@ -201,13 +201,12 @@ public class TestRunscript extends TestBase implements Trigger {
Recover.execute(getBaseDir(), "runscript"); Recover.execute(getBaseDir(), "runscript");
deleteDb("runscriptRestoreRecover"); deleteDb("runscriptRestoreRecover");
Connection conn3 = getConnection("runscriptRestoreRecover", "tempUser", getPassword()); Connection conn3 = getConnection("runscriptRestoreRecover");
Statement stat3 = conn3.createStatement(); Statement stat3 = conn3.createStatement();
stat3.execute("runscript from '" + getBaseDir() + "/runscript.h2.sql'"); stat3.execute("runscript from '" + getBaseDir() + "/runscript.h2.sql'");
conn3.close(); conn3.close();
conn3 = getConnection("runscriptRestoreRecover"); conn3 = getConnection("runscriptRestoreRecover");
stat3 = conn3.createStatement(); stat3 = conn3.createStatement();
stat3.execute("drop user tempUser");
if (config.cipher != null) { if (config.cipher != null) {
ChangeFileEncryption.execute(getBaseDir(), "runscript", config.cipher, null, getFilePassword().toCharArray(), true); ChangeFileEncryption.execute(getBaseDir(), "runscript", config.cipher, null, getFilePassword().toCharArray(), true);
......
...@@ -38,6 +38,7 @@ public class TestRecovery extends TestBase { ...@@ -38,6 +38,7 @@ public class TestRecovery extends TestBase {
private void testCompressedAndUncompressed() throws SQLException { private void testCompressedAndUncompressed() throws SQLException {
DeleteDbFiles.execute(getBaseDir(), "recovery", true); DeleteDbFiles.execute(getBaseDir(), "recovery", true);
DeleteDbFiles.execute(getBaseDir(), "recovery2", true);
org.h2.Driver.load(); org.h2.Driver.load();
Connection conn = getConnection("recovery"); Connection conn = getConnection("recovery");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
...@@ -48,12 +49,11 @@ public class TestRecovery extends TestBase { ...@@ -48,12 +49,11 @@ public class TestRecovery extends TestBase {
conn.close(); conn.close();
Recover rec = new Recover(); Recover rec = new Recover();
rec.runTool("-dir", getBaseDir(), "-db", "recovery"); rec.runTool("-dir", getBaseDir(), "-db", "recovery");
Connection conn2 = getConnection("recovery2", "diff", ""); Connection conn2 = getConnection("recovery2");
Statement stat2 = conn2.createStatement(); Statement stat2 = conn2.createStatement();
String name = "recovery.h2.sql"; String name = "recovery.h2.sql";
stat2.execute("runscript from '" + getBaseDir() + "/" + name + "'"); stat2.execute("runscript from '" + getBaseDir() + "/" + name + "'");
stat2.execute("select * from test"); stat2.execute("select * from test");
stat2.execute("drop user diff");
conn2.close(); conn2.close();
conn = getConnection("recovery"); conn = getConnection("recovery");
...@@ -92,13 +92,12 @@ public class TestRecovery extends TestBase { ...@@ -92,13 +92,12 @@ public class TestRecovery extends TestBase {
String out = new String(buff.toByteArray()); String out = new String(buff.toByteArray());
assertTrue(out.indexOf("Created file") >= 0); assertTrue(out.indexOf("Created file") >= 0);
Connection conn2 = getConnection("recovery2", "diff", ""); Connection conn2 = getConnection("recovery2");
Statement stat2 = conn2.createStatement(); Statement stat2 = conn2.createStatement();
String name = "recovery.h2.sql"; String name = "recovery.h2.sql";
stat2.execute("runscript from '" + getBaseDir() + "/" + name + "'"); stat2.execute("runscript from '" + getBaseDir() + "/" + name + "'");
stat2.execute("select * from test"); stat2.execute("select * from test");
stat2.execute("drop user diff");
conn2.close(); conn2.close();
conn = getConnection("recovery"); conn = getConnection("recovery");
......
...@@ -64,7 +64,6 @@ public class TestTools extends TestBase { ...@@ -64,7 +64,6 @@ public class TestTools extends TestBase {
if (config.networked) { if (config.networked) {
return; return;
} }
testSimpleResultSet();
org.h2.Driver.load(); org.h2.Driver.load();
testJdbcDriverUtils(); testJdbcDriverUtils();
testWrongServer(); testWrongServer();
...@@ -84,6 +83,7 @@ public class TestTools extends TestBase { ...@@ -84,6 +83,7 @@ public class TestTools extends TestBase {
testScriptRunscript(); testScriptRunscript();
testBackupRestore(); testBackupRestore();
testRecover(); testRecover();
testSimpleResultSet();
deleteDb("utils"); deleteDb("utils");
IOUtils.delete(getBaseDir() + "/b2.sql"); IOUtils.delete(getBaseDir() + "/b2.sql");
IOUtils.delete(getBaseDir() + "/b2.sql.txt"); IOUtils.delete(getBaseDir() + "/b2.sql.txt");
...@@ -473,7 +473,7 @@ public class TestTools extends TestBase { ...@@ -473,7 +473,7 @@ public class TestTools extends TestBase {
} }
} }
conn = DriverManager.getConnection(url, "another", "another"); conn = DriverManager.getConnection(url);
stat = conn.createStatement(); stat = conn.createStatement();
String suffix = ".h2.sql"; String suffix = ".h2.sql";
stat.execute("runscript from '" + getBaseDir() + "/toolsRecover" + suffix + "'"); stat.execute("runscript from '" + getBaseDir() + "/toolsRecover" + suffix + "'");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论