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

Changes to prepare for version 1.4.x beta

上级 d63384b6
...@@ -11,7 +11,7 @@ import java.sql.ResultSet; ...@@ -11,7 +11,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import org.h2.constant.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.util.Task; import org.h2.util.Task;
......
...@@ -11,7 +11,7 @@ import java.sql.ResultSet; ...@@ -11,7 +11,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import org.h2.constant.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.test.TestBase; import org.h2.test.TestBase;
/** /**
......
...@@ -35,9 +35,9 @@ import javax.servlet.http.HttpServletResponse; ...@@ -35,9 +35,9 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import org.h2.constant.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.constant.SysProperties;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.engine.SysProperties;
import org.h2.server.web.WebServlet; import org.h2.server.web.WebServlet;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase; import org.h2.test.TestBase;
......
...@@ -18,7 +18,7 @@ import java.sql.SQLException; ...@@ -18,7 +18,7 @@ import java.sql.SQLException;
import java.sql.Savepoint; import java.sql.Savepoint;
import java.sql.Statement; import java.sql.Statement;
import org.h2.constant.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.engine.Database; import org.h2.engine.Database;
import org.h2.jdbc.JdbcConnection; import org.h2.jdbc.JdbcConnection;
......
...@@ -31,7 +31,8 @@ import java.util.Calendar; ...@@ -31,7 +31,8 @@ import java.util.Calendar;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.jdbc.JdbcConnection; import org.h2.jdbc.JdbcConnection;
import org.h2.store.FileLister; import org.h2.store.FileLister;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
......
...@@ -10,7 +10,8 @@ import java.sql.Connection; ...@@ -10,7 +10,8 @@ import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.test.utils.FilePathUnstable; import org.h2.test.utils.FilePathUnstable;
......
...@@ -15,7 +15,7 @@ import java.sql.Statement; ...@@ -15,7 +15,7 @@ import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import org.h2.constant.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.test.utils.SelfDestructor; import org.h2.test.utils.SelfDestructor;
......
...@@ -16,7 +16,8 @@ import java.sql.Statement; ...@@ -16,7 +16,8 @@ import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Random; import java.util.Random;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.util.New; import org.h2.util.New;
......
...@@ -10,7 +10,8 @@ import java.sql.Connection; ...@@ -10,7 +10,8 @@ import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.test.utils.FilePathDebug; import org.h2.test.utils.FilePathDebug;
......
...@@ -13,7 +13,8 @@ import java.sql.SQLException; ...@@ -13,7 +13,8 @@ import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.test.utils.FilePathDebug; import org.h2.test.utils.FilePathDebug;
import org.h2.util.New; import org.h2.util.New;
......
...@@ -9,7 +9,8 @@ package org.h2.test.synth; ...@@ -9,7 +9,8 @@ package org.h2.test.synth;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import org.h2.constant.SysProperties;
import org.h2.engine.SysProperties;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.TestAll; import org.h2.test.TestAll;
import org.h2.test.TestBase; import org.h2.test.TestBase;
......
...@@ -12,7 +12,7 @@ import java.sql.ResultSet; ...@@ -12,7 +12,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import org.h2.api.DatabaseEventListener; import org.h2.api.DatabaseEventListener;
import org.h2.constant.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.tools.Server; import org.h2.tools.Server;
......
...@@ -25,7 +25,7 @@ public class TestClearReferences extends TestBase { ...@@ -25,7 +25,7 @@ public class TestClearReferences extends TestBase {
private static final String[] KNOWN_REFRESHED = { private static final String[] KNOWN_REFRESHED = {
"org.h2.compress.CompressLZF.cachedHashTable", "org.h2.compress.CompressLZF.cachedHashTable",
"org.h2.constant.DbSettings.defaultSettings", "org.h2.engine.DbSettings.defaultSettings",
"org.h2.engine.SessionRemote.sessionFactory", "org.h2.engine.SessionRemote.sessionFactory",
"org.h2.jdbcx.JdbcDataSourceFactory.cachedTraceSystem", "org.h2.jdbcx.JdbcDataSourceFactory.cachedTraceSystem",
"org.h2.store.RecoverTester.instance", "org.h2.store.RecoverTester.instance",
......
...@@ -8,7 +8,8 @@ package org.h2.test.unit; ...@@ -8,7 +8,8 @@ package org.h2.test.unit;
import java.sql.Connection; import java.sql.Connection;
import java.sql.Statement; import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase; import org.h2.test.TestBase;
/** /**
......
...@@ -11,7 +11,8 @@ import java.sql.DriverManager; ...@@ -11,7 +11,8 @@ import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.util.Task; import org.h2.util.Task;
......
...@@ -8,14 +8,18 @@ package org.h2.test.unit; ...@@ -8,14 +8,18 @@ package org.h2.test.unit;
import java.io.File; import java.io.File;
import java.util.Properties; import java.util.Properties;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.engine.ConnectionInfo; import org.h2.engine.ConnectionInfo;
import org.h2.engine.SysProperties;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.tools.DeleteDbFiles;
/** /**
* Test the ConnectionInfo class. * Test the ConnectionInfo class.
* *
* @author Kerry Sainsbury * @author Kerry Sainsbury
* @author Thomas Mueller Graf
*/ */
public class TestConnectionInfo extends TestBase { public class TestConnectionInfo extends TestBase {
...@@ -30,10 +34,24 @@ public class TestConnectionInfo extends TestBase { ...@@ -30,10 +34,24 @@ public class TestConnectionInfo extends TestBase {
@Override @Override
public void test() throws Exception { public void test() throws Exception {
testImplicitRelativePath();
testConnectInitError(); testConnectInitError();
testConnectionInfo(); testConnectionInfo();
testName(); testName();
} }
private void testImplicitRelativePath() throws Exception {
if (SysProperties.IMPLICIT_RELATIVE_PATH) {
return;
}
assertThrows(ErrorCode.URL_RELATIVE_TO_CWD, this).
getConnection("jdbc:h2:test");
assertThrows(ErrorCode.URL_RELATIVE_TO_CWD, this).
getConnection("jdbc:h2:data/test");
getConnection("jdbc:h2:./testDatabase").close();
DeleteDbFiles.execute(".", "testDatabase", true);
}
private void testConnectInitError() throws Exception { private void testConnectInitError() throws Exception {
assertThrows(ErrorCode.SYNTAX_ERROR_2, this). assertThrows(ErrorCode.SYNTAX_ERROR_2, this).
...@@ -69,7 +87,7 @@ public class TestConnectionInfo extends TestBase { ...@@ -69,7 +87,7 @@ public class TestConnectionInfo extends TestBase {
private void testName() throws Exception { private void testName() throws Exception {
char differentFileSeparator = File.separatorChar == '/' ? '\\' : '/'; char differentFileSeparator = File.separatorChar == '/' ? '\\' : '/';
ConnectionInfo connectionInfo = new ConnectionInfo("test" + ConnectionInfo connectionInfo = new ConnectionInfo("./test" +
differentFileSeparator + "subDir"); differentFileSeparator + "subDir");
File file = new File("test" + File.separatorChar + "subDir"); File file = new File("test" + File.separatorChar + "subDir");
assertEquals(file.getCanonicalPath().replace('\\', '/'), assertEquals(file.getCanonicalPath().replace('\\', '/'),
......
...@@ -50,7 +50,7 @@ import org.h2.value.ValueUuid; ...@@ -50,7 +50,7 @@ import org.h2.value.ValueUuid;
public class TestDataPage extends TestBase implements DataHandler { public class TestDataPage extends TestBase implements DataHandler {
private boolean testPerformance; private boolean testPerformance;
private final CompareMode compareMode = CompareMode.getInstance(null, 0, false); private final CompareMode compareMode = CompareMode.getInstance(null, 0);
/** /**
* Run just this test. * Run just this test.
......
...@@ -14,8 +14,9 @@ import java.util.ArrayList; ...@@ -14,8 +14,9 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.TimeZone; import java.util.TimeZone;
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties; import org.h2.api.ErrorCode;
import org.h2.engine.SysProperties;
import org.h2.store.Data; import org.h2.store.Data;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.test.utils.AssertThrows; import org.h2.test.utils.AssertThrows;
......
...@@ -8,7 +8,8 @@ package org.h2.test.unit; ...@@ -8,7 +8,8 @@ package org.h2.test.unit;
import java.io.File; import java.io.File;
import java.sql.Connection; import java.sql.Connection;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.message.TraceSystem; import org.h2.message.TraceSystem;
import org.h2.store.FileLock; import org.h2.store.FileLock;
......
...@@ -15,7 +15,7 @@ import java.sql.Statement; ...@@ -15,7 +15,7 @@ import java.sql.Statement;
import java.util.List; import java.util.List;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import org.h2.constant.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.jdbc.JdbcConnection; import org.h2.jdbc.JdbcConnection;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase; import org.h2.test.TestBase;
......
...@@ -9,7 +9,8 @@ package org.h2.test.unit; ...@@ -9,7 +9,8 @@ package org.h2.test.unit;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Statement; import java.sql.Statement;
import org.h2.constant.SysProperties;
import org.h2.engine.SysProperties;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.util.IOUtils; import org.h2.util.IOUtils;
......
...@@ -18,7 +18,8 @@ import java.sql.SQLException; ...@@ -18,7 +18,8 @@ import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.sql.Types; import java.sql.Types;
import java.util.Properties; import java.util.Properties;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.tools.Server; import org.h2.tools.Server;
......
...@@ -19,7 +19,7 @@ import java.util.Random; ...@@ -19,7 +19,7 @@ import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import org.h2.api.DatabaseEventListener; import org.h2.api.DatabaseEventListener;
import org.h2.constant.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.result.Row; import org.h2.result.Row;
import org.h2.store.Page; import org.h2.store.Page;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
......
...@@ -11,7 +11,8 @@ import java.sql.Connection; ...@@ -11,7 +11,8 @@ import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase; import org.h2.test.TestBase;
......
...@@ -33,18 +33,18 @@ public class TestPattern extends TestBase { ...@@ -33,18 +33,18 @@ public class TestPattern extends TestBase {
private void testCompareModeReuse() { private void testCompareModeReuse() {
CompareMode mode1, mode2; CompareMode mode1, mode2;
mode1 = CompareMode.getInstance(null, 0, false); mode1 = CompareMode.getInstance(null, 0);
mode2 = CompareMode.getInstance(null, 0, false); mode2 = CompareMode.getInstance(null, 0);
assertTrue(mode1 == mode2); assertTrue(mode1 == mode2);
mode1 = CompareMode.getInstance("DE", Collator.SECONDARY, false); mode1 = CompareMode.getInstance("DE", Collator.SECONDARY);
assertFalse(mode1 == mode2); assertFalse(mode1 == mode2);
mode2 = CompareMode.getInstance("DE", Collator.SECONDARY, false); mode2 = CompareMode.getInstance("DE", Collator.SECONDARY);
assertTrue(mode1 == mode2); assertTrue(mode1 == mode2);
} }
private void testPattern() { private void testPattern() {
CompareMode mode = CompareMode.getInstance(null, 0, false); CompareMode mode = CompareMode.getInstance(null, 0);
CompareLike comp = new CompareLike(mode, "\\", null, null, null, false); CompareLike comp = new CompareLike(mode, "\\", null, null, null, false);
test(comp, "B", "%_"); test(comp, "B", "%_");
test(comp, "A", "A%"); test(comp, "A", "A%");
......
...@@ -9,7 +9,8 @@ package org.h2.test.unit; ...@@ -9,7 +9,8 @@ package org.h2.test.unit;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.HashSet; import java.util.HashSet;
import java.util.Properties; import java.util.Properties;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.engine.ConnectionInfo; import org.h2.engine.ConnectionInfo;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.engine.Database; import org.h2.engine.Database;
......
...@@ -176,7 +176,7 @@ public class TestSecurity extends TestBase { ...@@ -176,7 +176,7 @@ public class TestSecurity extends TestBase {
} }
private void testBlockCiphers() { private void testBlockCiphers() {
for (String algorithm : new String[] { "AES", "XTEA", "FOG" }) { for (String algorithm : new String[] { "AES", "FOG" }) {
byte[] test = new byte[4096]; byte[] test = new byte[4096];
BlockCipher cipher = CipherFactory.getBlockCipher(algorithm); BlockCipher cipher = CipherFactory.getBlockCipher(algorithm);
cipher.setKey("abcdefghijklmnop".getBytes()); cipher.setKey("abcdefghijklmnop".getBytes());
......
...@@ -22,7 +22,7 @@ import javax.servlet.Servlet; ...@@ -22,7 +22,7 @@ import javax.servlet.Servlet;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextEvent;
import org.h2.constant.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.server.web.DbStarter; import org.h2.server.web.DbStarter;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.util.New; import org.h2.util.New;
......
...@@ -35,8 +35,8 @@ import java.sql.Types; ...@@ -35,8 +35,8 @@ import java.sql.Types;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import org.h2.constant.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.constant.SysProperties; import org.h2.engine.SysProperties;
import org.h2.store.FileLister; import org.h2.store.FileLister;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase; import org.h2.test.TestBase;
...@@ -79,6 +79,7 @@ public class TestTools extends TestBase { ...@@ -79,6 +79,7 @@ public class TestTools extends TestBase {
if (config.networked) { if (config.networked) {
return; return;
} }
DeleteDbFiles.execute(getBaseDir(), null, true);
org.h2.Driver.load(); org.h2.Driver.load();
testSimpleResultSet(); testSimpleResultSet();
testTcpServerWithoutPort(); testTcpServerWithoutPort();
...@@ -192,6 +193,8 @@ public class TestTools extends TestBase { ...@@ -192,6 +193,8 @@ public class TestTools extends TestBase {
createClassProxy(rs.getClass()); createClassProxy(rs.getClass());
assertThrows(IllegalStateException.class, rs). assertThrows(IllegalStateException.class, rs).
addColumn(null, 0, 0, 0); addColumn(null, 0, 0, 0);
assertEquals(ResultSet.TYPE_FORWARD_ONLY, rs.getType());
rs.next(); rs.next();
assertEquals(1, rs.getInt(1)); assertEquals(1, rs.getInt(1));
assertEquals("1", rs.getString(1)); assertEquals("1", rs.getString(1));
...@@ -219,6 +222,8 @@ public class TestTools extends TestBase { ...@@ -219,6 +222,8 @@ public class TestTools extends TestBase {
assertEquals(1, rs.getColumnCount()); assertEquals(1, rs.getColumnCount());
rs = new SimpleResultSet(); rs = new SimpleResultSet();
rs.setAutoClose(false);
rs.addColumn("a", Types.BIGINT, 0, 0); rs.addColumn("a", Types.BIGINT, 0, 0);
rs.addColumn("b", Types.BINARY, 0, 0); rs.addColumn("b", Types.BINARY, 0, 0);
rs.addColumn("c", Types.BOOLEAN, 0, 0); rs.addColumn("c", Types.BOOLEAN, 0, 0);
...@@ -421,9 +426,10 @@ public class TestTools extends TestBase { ...@@ -421,9 +426,10 @@ public class TestTools extends TestBase {
} }
assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection()); assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection());
assertEquals(0, rs.getFetchSize()); assertEquals(0, rs.getFetchSize());
assertEquals(ResultSet.TYPE_FORWARD_ONLY, rs.getType()); assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType());
assertTrue(rs.getStatement() == null); assertTrue(rs.getStatement() == null);
assertFalse(rs.isClosed()); assertFalse(rs.isClosed());
rs.beforeFirst(); rs.beforeFirst();
assertEquals(0, rs.getRow()); assertEquals(0, rs.getRow());
assertTrue(rs.next()); assertTrue(rs.next());
...@@ -433,8 +439,10 @@ public class TestTools extends TestBase { ...@@ -433,8 +439,10 @@ public class TestTools extends TestBase {
assertFalse(rs.next()); assertFalse(rs.next());
assertThrows(ErrorCode.NO_DATA_AVAILABLE, (ResultSet) rs). assertThrows(ErrorCode.NO_DATA_AVAILABLE, (ResultSet) rs).
getInt(1); getInt(1);
assertTrue(rs.isClosed());
assertEquals(0, rs.getRow()); assertEquals(0, rs.getRow());
assertFalse(rs.isClosed());
rs.close();
assertTrue(rs.isClosed());
} }
private void testJdbcDriverUtils() { private void testJdbcDriverUtils() {
...@@ -835,7 +843,7 @@ public class TestTools extends TestBase { ...@@ -835,7 +843,7 @@ public class TestTools extends TestBase {
conn.close(); conn.close();
Script.main("-url", url, "-user", user, "-password", password, Script.main("-url", url, "-user", user, "-password", password,
"-script", fileName, "-options", "nodata", "compression", "-script", fileName, "-options", "nodata", "compression",
"lzf", "cipher", "xtea", "password", "'123'", "charset", "lzf", "cipher", "aes", "password", "'123'", "charset",
"'utf-8'"); "'utf-8'");
Script.main("-url", url, "-user", user, "-password", password, Script.main("-url", url, "-user", user, "-password", password,
"-script", fileName + ".txt"); "-script", fileName + ".txt");
...@@ -843,7 +851,7 @@ public class TestTools extends TestBase { ...@@ -843,7 +851,7 @@ public class TestTools extends TestBase {
"-quiet"); "-quiet");
RunScript.main("-url", url, "-user", user, "-password", password, RunScript.main("-url", url, "-user", user, "-password", password,
"-script", fileName, "-options", "compression", "lzf", "-script", fileName, "-options", "compression", "lzf",
"cipher", "xtea", "password", "'123'", "charset", "'utf-8'"); "cipher", "aes", "password", "'123'", "charset", "'utf-8'");
conn = getConnection( conn = getConnection(
"jdbc:h2:" + getBaseDir() + "/testScriptRunscript", "sa", "abc"); "jdbc:h2:" + getBaseDir() + "/testScriptRunscript", "sa", "abc");
ResultSet rs = conn.createStatement() ResultSet rs = conn.createStatement()
...@@ -906,13 +914,13 @@ public class TestTools extends TestBase { ...@@ -906,13 +914,13 @@ public class TestTools extends TestBase {
String url = "jdbc:h2:" + dir; String url = "jdbc:h2:" + dir;
DeleteDbFiles.execute(dir, "testChangeFileEncryption", true); DeleteDbFiles.execute(dir, "testChangeFileEncryption", true);
Connection conn = getConnection(url + Connection conn = getConnection(url +
"/testChangeFileEncryption;CIPHER=XTEA", "sa", "abc 123"); "/testChangeFileEncryption;CIPHER=AES", "sa", "abc 123");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, DATA CLOB) " stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, DATA CLOB) "
+ "AS SELECT X, SPACE(3000) FROM SYSTEM_RANGE(1, 300)"); + "AS SELECT X, SPACE(3000) FROM SYSTEM_RANGE(1, 300)");
conn.close(); conn.close();
String[] args = { "-dir", dir, "-db", "testChangeFileEncryption", String[] args = { "-dir", dir, "-db", "testChangeFileEncryption",
"-cipher", "XTEA", "-decrypt", "abc", "-quiet" }; "-cipher", "AES", "-decrypt", "abc", "-quiet" };
ChangeFileEncryption.main(args); ChangeFileEncryption.main(args);
args = new String[] { "-dir", dir, "-db", "testChangeFileEncryption", args = new String[] { "-dir", dir, "-db", "testChangeFileEncryption",
"-cipher", "AES", "-encrypt", "def", "-quiet" }; "-cipher", "AES", "-encrypt", "def", "-quiet" };
......
...@@ -15,7 +15,8 @@ import java.sql.Time; ...@@ -15,7 +15,8 @@ import java.sql.Time;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.sql.Types; import java.sql.Types;
import java.util.UUID; import java.util.UUID;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.test.utils.AssertThrows; import org.h2.test.utils.AssertThrows;
import org.h2.tools.SimpleResultSet; import org.h2.tools.SimpleResultSet;
...@@ -119,6 +120,7 @@ public class TestValue extends TestBase { ...@@ -119,6 +120,7 @@ public class TestValue extends TestBase {
private void testValueResultSet() throws SQLException { private void testValueResultSet() throws SQLException {
SimpleResultSet rs = new SimpleResultSet(); SimpleResultSet rs = new SimpleResultSet();
rs.setAutoClose(false);
rs.addColumn("ID", Types.INTEGER, 0, 0); rs.addColumn("ID", Types.INTEGER, 0, 0);
rs.addColumn("NAME", Types.VARCHAR, 255, 0); rs.addColumn("NAME", Types.VARCHAR, 255, 0);
rs.addRow(1, "Hello"); rs.addRow(1, "Hello");
......
...@@ -31,7 +31,7 @@ import org.h2.value.ValueInt; ...@@ -31,7 +31,7 @@ import org.h2.value.ValueInt;
*/ */
public class TestValueHashMap extends TestBase implements DataHandler { public class TestValueHashMap extends TestBase implements DataHandler {
CompareMode compareMode = CompareMode.getInstance(null, 0, false); CompareMode compareMode = CompareMode.getInstance(null, 0);
/** /**
* Run just this test. * Run just this test.
......
...@@ -165,7 +165,7 @@ public class ArchiveTool { ...@@ -165,7 +165,7 @@ public class ArchiveTool {
} }
} }
} }
// int: metadata length // int: metadata length
// byte: 0: directory, 1: file // byte: 0: directory, 1: file
// varLong: lastModified // varLong: lastModified
......
...@@ -22,8 +22,8 @@ import java.util.zip.ZipEntry; ...@@ -22,8 +22,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import org.h2.command.dml.BackupCommand; import org.h2.command.dml.BackupCommand;
import org.h2.constant.SysProperties;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.engine.SysProperties;
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.util.IOUtils; import org.h2.util.IOUtils;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论