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

Formatting.

上级 126fd829
...@@ -251,7 +251,7 @@ public class FilePathDisk extends FilePath { ...@@ -251,7 +251,7 @@ public class FilePathDisk extends FilePath {
if (dir.isDirectory()) { if (dir.isDirectory()) {
return; return;
} }
throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1, throw DbException.get(ErrorCode.FILE_CREATION_FAILED_1,
name + " (a file with this name already exists)"); name + " (a file with this name already exists)");
} else if (dir.mkdir()) { } else if (dir.mkdir()) {
return; return;
......
...@@ -168,7 +168,7 @@ public class FilePathEncrypt extends FilePathWrapper { ...@@ -168,7 +168,7 @@ public class FilePathEncrypt extends FilePathWrapper {
private long size; private long size;
private final String name; private final String name;
private XTS xts; private XTS xts;
private byte[] encryptionKey; private byte[] encryptionKey;
...@@ -181,7 +181,7 @@ public class FilePathEncrypt extends FilePathWrapper { ...@@ -181,7 +181,7 @@ public class FilePathEncrypt extends FilePathWrapper {
this.base = base; this.base = base;
this.encryptionKey = encryptionKey; this.encryptionKey = encryptionKey;
} }
private void init() throws IOException { private void init() throws IOException {
if (xts != null) { if (xts != null) {
return; return;
......
...@@ -228,18 +228,18 @@ public class Recover extends Tool implements DataHandler { ...@@ -228,18 +228,18 @@ public class Recover extends Tool implements DataHandler {
*/ */
public static InputStream readBlobMap(Connection conn, long lobId, long precision) throws SQLException { public static InputStream readBlobMap(Connection conn, long lobId, long precision) throws SQLException {
final PreparedStatement prep = conn.prepareStatement( final PreparedStatement prep = conn.prepareStatement(
"SELECT DATA FROM INFORMATION_SCHEMA.LOB_BLOCKS " + "SELECT DATA FROM INFORMATION_SCHEMA.LOB_BLOCKS " +
"WHERE LOB_ID = ? AND SEQ = ? AND ? > 0"); "WHERE LOB_ID = ? AND SEQ = ? AND ? > 0");
prep.setLong(1, lobId); prep.setLong(1, lobId);
// precision is currently not really used, // precision is currently not really used,
// it is just to improve readability of the script // it is just to improve readability of the script
prep.setLong(3, precision); prep.setLong(3, precision);
return new SequenceInputStream( return new SequenceInputStream(
new Enumeration<InputStream>() { new Enumeration<InputStream>() {
private int seq; private int seq;
private byte[] data = fetch(); private byte[] data = fetch();
private byte[] fetch() { private byte[] fetch() {
try { try {
prep.setInt(2, seq++); prep.setInt(2, seq++);
...@@ -252,7 +252,7 @@ public class Recover extends Tool implements DataHandler { ...@@ -252,7 +252,7 @@ public class Recover extends Tool implements DataHandler {
throw DbException.convert(e); throw DbException.convert(e);
} }
} }
@Override @Override
public boolean hasMoreElements() { public boolean hasMoreElements() {
return data != null; return data != null;
...@@ -559,7 +559,7 @@ public class Recover extends Tool implements DataHandler { ...@@ -559,7 +559,7 @@ public class Recover extends Tool implements DataHandler {
setDatabaseName(fileName.substring(0, fileName.length() - Constants.SUFFIX_MV_FILE.length())); setDatabaseName(fileName.substring(0, fileName.length() - Constants.SUFFIX_MV_FILE.length()));
MVStore mv = new MVStore.Builder().fileName(fileName).readOnly().open(); MVStore mv = new MVStore.Builder().fileName(fileName).readOnly().open();
dumpLobMaps(writer, mv); dumpLobMaps(writer, mv);
writer.println("-- Tables"); writer.println("-- Tables");
TransactionStore store = new TransactionStore(mv); TransactionStore store = new TransactionStore(mv);
try { try {
for (String mapName : mv.getMapNames()) { for (String mapName : mv.getMapNames()) {
...@@ -627,7 +627,7 @@ public class Recover extends Tool implements DataHandler { ...@@ -627,7 +627,7 @@ public class Recover extends Tool implements DataHandler {
mv.close(); mv.close();
} }
} }
private void dumpLobMaps(PrintWriter writer, MVStore mv) { private void dumpLobMaps(PrintWriter writer, MVStore mv) {
lobMaps = mv.hasMap("lobData"); lobMaps = mv.hasMap("lobData");
if (!lobMaps) { if (!lobMaps) {
...@@ -637,8 +637,8 @@ public class Recover extends Tool implements DataHandler { ...@@ -637,8 +637,8 @@ public class Recover extends Tool implements DataHandler {
StreamStore streamStore = new StreamStore(lobData); StreamStore streamStore = new StreamStore(lobData);
MVMap<Long, Object[]> lobMap = mv.openMap("lobMap"); MVMap<Long, Object[]> lobMap = mv.openMap("lobMap");
writer.println("-- LOB"); writer.println("-- LOB");
writer.println("CREATE TABLE IF NOT EXISTS " + writer.println("CREATE TABLE IF NOT EXISTS " +
"INFORMATION_SCHEMA.LOB_BLOCKS(" + "INFORMATION_SCHEMA.LOB_BLOCKS(" +
"LOB_ID BIGINT, SEQ INT, DATA BINARY);"); "LOB_ID BIGINT, SEQ INT, DATA BINARY);");
for (Entry<Long, Object[]> e : lobMap.entrySet()) { for (Entry<Long, Object[]> e : lobMap.entrySet()) {
long lobId = e.getKey(); long lobId = e.getKey();
...@@ -652,7 +652,7 @@ public class Recover extends Tool implements DataHandler { ...@@ -652,7 +652,7 @@ public class Recover extends Tool implements DataHandler {
int l = IOUtils.readFully(in, block, block.length); int l = IOUtils.readFully(in, block, block.length);
String x = StringUtils.convertBytesToHex(block, l); String x = StringUtils.convertBytesToHex(block, l);
if (l > 0) { if (l > 0) {
writer.println("INSERT INTO INFORMATION_SCHEMA.LOB_BLOCKS " + writer.println("INSERT INTO INFORMATION_SCHEMA.LOB_BLOCKS " +
"VALUES(" + lobId + ", " + seq + ", '" + x + "');"); "VALUES(" + lobId + ", " + seq + ", '" + x + "');");
} }
if (l != len) { if (l != len) {
......
...@@ -32,7 +32,7 @@ import org.h2.util.Utils; ...@@ -32,7 +32,7 @@ import org.h2.util.Utils;
/** /**
* A implementation of the BLOB and CLOB data types. * A implementation of the BLOB and CLOB data types.
* *
* Small objects are kept in memory and stored in the record. * Small objects are kept in memory and stored in the record.
* Large objects are either stored in the database, or in temporary files. * Large objects are either stored in the database, or in temporary files.
*/ */
...@@ -561,7 +561,8 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo ...@@ -561,7 +561,8 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
int inplace = handler.getMaxLengthInplaceLob(); int inplace = handler.getMaxLengthInplaceLob();
long m = compress ? Constants.IO_BUFFER_SIZE_COMPRESS : Constants.IO_BUFFER_SIZE; long m = compress ? Constants.IO_BUFFER_SIZE_COMPRESS : Constants.IO_BUFFER_SIZE;
if (m < remaining && m <= inplace) { if (m < remaining && m <= inplace) {
// using "1L" to force long arithmetic because inplace could be Integer.MAX_VALUE // using "1L" to force long arithmetic because
// inplace could be Integer.MAX_VALUE
m = Math.min(remaining, inplace + 1L); m = Math.min(remaining, inplace + 1L);
// the buffer size must be bigger than the inplace lob, otherwise we can't // the buffer size must be bigger than the inplace lob, otherwise we can't
// know if it must be stored in-place or not // know if it must be stored in-place or not
...@@ -626,7 +627,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo ...@@ -626,7 +627,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
} }
return createSmallLob(type, small, precision); return createSmallLob(type, small, precision);
} }
/** /**
* Create a LOB object that fits in memory. * Create a LOB object that fits in memory.
* *
......
...@@ -1500,12 +1500,12 @@ public abstract class TestBase { ...@@ -1500,12 +1500,12 @@ public abstract class TestBase {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
/** /**
* Construct a stream of 20 KB that fails while reading with the provided * Construct a stream of 20 KB that fails while reading with the provided
* exception. * exception.
* *
* @param e the exception * @param e the exception
* @return the stream * @return the stream
*/ */
...@@ -1524,13 +1524,13 @@ public abstract class TestBase { ...@@ -1524,13 +1524,13 @@ public abstract class TestBase {
/** /**
* Throw a checked exception, without having to declare the method as * Throw a checked exception, without having to declare the method as
* throwing a checked exception. * throwing a checked exception.
* *
* @param e the exception to throw * @param e the exception to throw
*/ */
public static void throwException(Throwable e) { public static void throwException(Throwable e) {
TestBase.<RuntimeException>throwThis(e); TestBase.<RuntimeException>throwThis(e);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static <E extends Throwable> void throwThis(Throwable e) throws E { private static <E extends Throwable> void throwThis(Throwable e) throws E {
throw (E) e; throw (E) e;
......
...@@ -743,7 +743,7 @@ public class TestLob extends TestBase { ...@@ -743,7 +743,7 @@ public class TestLob extends TestBase {
int rows = 0; int rows = 0;
Savepoint sp = null; Savepoint sp = null;
int len = getSize(100, 400); int len = getSize(100, 400);
// config.traceTest = true; // config.traceTest = true;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
switch (random.nextInt(10)) { switch (random.nextInt(10)) {
case 0: case 0:
......
...@@ -262,7 +262,7 @@ public class TestSequence extends TestBase { ...@@ -262,7 +262,7 @@ public class TestSequence extends TestBase {
stat.execute("create sequence b START WITH 7320917853639540658 INCREMENT -1"); stat.execute("create sequence b START WITH 7320917853639540658 INCREMENT -1");
conn.close(); conn.close();
} }
private void testTwo() throws SQLException { private void testTwo() throws SQLException {
deleteDb("sequence"); deleteDb("sequence");
Connection conn = getConnection("sequence"); Connection conn = getConnection("sequence");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论