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

Formatting.

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