提交 38a3055d authored 作者: Thomas Mueller's avatar Thomas Mueller

When using the MVStore, running a SQL script generate by the Recover tool from a…

When using the MVStore, running a SQL script generate by the Recover tool from a PageStore file failed with a strange error message (NPE), now a clear error message is shown.
上级 0b740e68
...@@ -28,6 +28,8 @@ import java.util.Iterator; ...@@ -28,6 +28,8 @@ import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.zip.CRC32; import java.util.zip.CRC32;
import org.h2.api.ErrorCode;
import org.h2.api.JavaObjectSerializer; import org.h2.api.JavaObjectSerializer;
import org.h2.compress.CompressLZF; import org.h2.compress.CompressLZF;
import org.h2.engine.Constants; import org.h2.engine.Constants;
...@@ -53,6 +55,7 @@ import org.h2.store.FileStore; ...@@ -53,6 +55,7 @@ import org.h2.store.FileStore;
import org.h2.store.FileStoreInputStream; import org.h2.store.FileStoreInputStream;
import org.h2.store.LobStorageBackend; import org.h2.store.LobStorageBackend;
import org.h2.store.LobStorageFrontend; import org.h2.store.LobStorageFrontend;
import org.h2.store.LobStorageMap;
import org.h2.store.Page; import org.h2.store.Page;
import org.h2.store.PageFreeList; import org.h2.store.PageFreeList;
import org.h2.store.PageLog; import org.h2.store.PageLog;
...@@ -213,16 +216,26 @@ public class Recover extends Tool implements DataHandler { ...@@ -213,16 +216,26 @@ public class Recover extends Tool implements DataHandler {
public static Value.ValueBlob readBlobDb(Connection conn, long lobId, public static Value.ValueBlob readBlobDb(Connection conn, long lobId,
long precision) { long precision) {
DataHandler h = ((JdbcConnection) conn).getSession().getDataHandler(); DataHandler h = ((JdbcConnection) conn).getSession().getDataHandler();
verifyPageStore(h);
return ValueLobDb.create(Value.BLOB, h, LobStorageFrontend.TABLE_TEMP, return ValueLobDb.create(Value.BLOB, h, LobStorageFrontend.TABLE_TEMP,
lobId, null, precision); lobId, null, precision);
} }
private static void verifyPageStore(DataHandler h) {
if (h.getLobStorage() instanceof LobStorageMap) {
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1,
"Restore page store recovery SQL script " +
"can only be restored to a PageStore file");
}
}
/** /**
* INTERNAL * INTERNAL
*/ */
public static Value.ValueClob readClobDb(Connection conn, long lobId, public static Value.ValueClob readClobDb(Connection conn, long lobId,
long precision) { long precision) {
DataHandler h = ((JdbcConnection) conn).getSession().getDataHandler(); DataHandler h = ((JdbcConnection) conn).getSession().getDataHandler();
verifyPageStore(h);
return ValueLobDb.create(Value.CLOB, h, LobStorageFrontend.TABLE_TEMP, return ValueLobDb.create(Value.CLOB, h, LobStorageFrontend.TABLE_TEMP,
lobId, null, precision); lobId, null, precision);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论