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

New lob storage.

上级 e831430d
...@@ -33,6 +33,9 @@ import org.h2.value.ValueLob2; ...@@ -33,6 +33,9 @@ import org.h2.value.ValueLob2;
*/ */
public class LobStorage { public class LobStorage {
/**
* The table id for session variables (LOBs not assigned to a table).
*/
public static final int TABLE_ID_SESSION_VARIABLE = -1; public static final int TABLE_ID_SESSION_VARIABLE = -1;
private static final String LOBS = "INFORMATION_SCHEMA.LOBS"; private static final String LOBS = "INFORMATION_SCHEMA.LOBS";
...@@ -93,7 +96,6 @@ public class LobStorage { ...@@ -93,7 +96,6 @@ public class LobStorage {
/** /**
* Remove all LOBs for this table. * Remove all LOBs for this table.
* *
* @param handler the data handler
* @param tableId the table id * @param tableId the table id
*/ */
public void removeAllForTable(int tableId) { public void removeAllForTable(int tableId) {
...@@ -249,6 +251,12 @@ public class LobStorage { ...@@ -249,6 +251,12 @@ public class LobStorage {
prep.execute(); prep.execute();
} }
/**
* Get the input stream for the given lob.
*
* @param lobId the lob id
* @return the stream
*/
public InputStream getInputStream(long lobId) throws IOException { public InputStream getInputStream(long lobId) throws IOException {
init(); init();
return new LobInputStream(conn, lobId); return new LobInputStream(conn, lobId);
...@@ -405,6 +413,13 @@ public class LobStorage { ...@@ -405,6 +413,13 @@ public class LobStorage {
return ValueLob.createBlob(in, maxLength, handler); return ValueLob.createBlob(in, maxLength, handler);
} }
/**
* Create a CLOB object.
*
* @param reader the reader
* @param maxLength the maximum length (-1 if not known)
* @return the LOB
*/
public Value createClob(Reader reader, long maxLength) { public Value createClob(Reader reader, long maxLength) {
if (SysProperties.LOB_IN_DATABASE) { if (SysProperties.LOB_IN_DATABASE) {
init(); init();
......
...@@ -66,6 +66,16 @@ public class ValueLob2 extends Value { ...@@ -66,6 +66,16 @@ public class ValueLob2 extends Value {
} }
} }
/**
* Create a LOB value.
*
* @param type the type
* @param lobStorage the storage
* @param fileName the file name (may be null)
* @param id the lob id
* @param precision the precision (number of bytes / characters)
* @return the value
*/
public static ValueLob2 create(int type, LobStorage lobStorage, String fileName, long id, long precision) { public static ValueLob2 create(int type, LobStorage lobStorage, String fileName, long id, long precision) {
return new ValueLob2(type, lobStorage, fileName, LobStorage.TABLE_ID_SESSION_VARIABLE, id, precision); return new ValueLob2(type, lobStorage, fileName, LobStorage.TABLE_ID_SESSION_VARIABLE, id, precision);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论