提交 c6cf352d authored 作者: Noel Grandin's avatar Noel Grandin

filename in ValueLob is now never null

上级 a686bf3e
......@@ -852,8 +852,8 @@ public class Data {
return ValueLob.openUnlinked(type, handler, tableId,
objectId, precision, compression, filename);
}
return ValueLob.openLinked(type, handler, tableId,
objectId, precision, compression);
return ValueLobDb.create(type, handler, tableId,
objectId, null, precision);
}
}
case Value.ARRAY: {
......
......@@ -30,18 +30,9 @@ import org.h2.util.StringUtils;
import org.h2.util.Utils;
/**
* Implementation of the BLOB and CLOB data types. Small objects are kept in
* memory and stored in the record.
*
* Large objects are stored in their own files. When large objects are set in a
* prepared statement, they are first stored as 'temporary' files. Later, when
* they are used in a record, and when the record is stored, the lob files are
* linked: the file is renamed using the file format (tableId).(objectId). There
* is one exception: large variables are stored in the file (-1).(objectId).
*
* When lobs are deleted, they are first renamed to a temp file, and if the
* delete operation is committed the file is deleted.
*
* This is the legacy implementation of LOBs for PageStore databases where the
* LOB was stored in an external file.
*
* Data compression is supported.
*/
public class ValueLob extends Value {
......@@ -141,24 +132,6 @@ public class ValueLob extends Value {
table + Constants.SUFFIX_LOB_FILE;
}
/**
* Create a LOB value with the given parameters.
*
* @param type the data type, either Value.BLOB or Value.CLOB
* @param handler the file handler
* @param tableId the table object id
* @param objectId the object id
* @param precision the precision (length in elements)
* @param compression if compression is used
* @return the value object
*/
public static ValueLob openLinked(int type, DataHandler handler,
int tableId, int objectId, long precision, boolean compression) {
String fileName = getFileName(handler, tableId, objectId);
return new ValueLob(type, handler, fileName, tableId, objectId,
true/* linked */, precision, compression);
}
/**
* Create a LOB value with the given parameters.
*
......@@ -328,17 +301,11 @@ public class ValueLob extends Value {
@Override
public void remove() {
if (fileName != null) {
deleteFile(handler, fileName);
}
deleteFile(handler, fileName);
}
@Override
public Value copy(DataHandler h, int tabId) {
if (fileName == null) {
this.tableId = tabId;
return this;
}
if (linked) {
ValueLob copy = new ValueLob(this.valueType, this.handler, this.fileName,
this.tableId, getNewObjectId(h), this.linked, this.precision, this.compressed);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论