UnitOfWorkListener
ClientBlob
, ClientClob
public abstract class Lob extends java.lang.Object implements UnitOfWorkListener
Modifier and Type | Field | Description |
---|---|---|
protected Agent |
agent_ |
|
(package private) static int |
ASCII_STREAM |
|
(package private) static int |
BINARY_STREAM |
|
(package private) static int |
BINARY_STRING |
|
(package private) static int |
CHARACTER_STREAM |
|
protected int |
dataType_ |
|
static int |
INVALID_LOCATOR |
|
protected boolean |
isValid_ |
This boolean variable indicates whether the Lob object has been
invalidated by calling free() on it
|
private boolean |
lengthObtained_ |
|
private static ClientMessageId |
LOB_OBJECT_LENGTH_UNKNOWN_YET |
|
(package private) static int |
LOCATOR |
|
protected int |
locator_ |
|
private long |
sqlLength_ |
|
(package private) static int |
STRING |
|
private int |
transactionID_ |
This integer identifies which transaction the Lob is associated with
|
(package private) static int |
UNICODE_STREAM |
|
private long |
updateCount |
|
private boolean |
willBeLayerBStreamed_ |
Modifier | Constructor | Description |
---|---|---|
protected |
Lob(Agent agent,
boolean willBeLayerBStreamed) |
Modifier and Type | Method | Description |
---|---|---|
(package private) void |
checkForClosedConnection() |
|
(package private) void |
checkForLocatorValidity() |
Calls SqlLength() to check if the Locator associated
with the underlying Lob is valid.
|
protected void |
checkPosAndLength(long pos,
long length) |
Checks the
pos and length . |
protected void |
checkValidity() |
Checks if isValid is true and whether the transaction that
created the Lob is still active.
|
void |
completeLocalCommit(java.util.Iterator listenerIterator) |
|
void |
completeLocalRollback(java.util.Iterator listenerIterator) |
|
Agent |
getAgent() |
|
int |
getLocator() |
Get locator for this Lob
|
(package private) long |
getLocatorLength() |
Get the length of locator based Lob from the server.
|
(package private) long |
getUpdateCount() |
Returns the current updateCount of the Clob.
|
protected void |
incrementUpdateCount() |
Increments and returns the new updateCount
of this
Lob . |
protected static boolean |
isLayerBStreamingPossible(Agent agent) |
|
boolean |
isLocator() |
Check whether this Lob is based on a locator
|
abstract long |
length() |
|
void |
listenToUnitOfWork() |
|
protected abstract void |
materializeStream() |
Method to be implemented by subclasses, so that
#materializedStream(InputStream, String) can be called with subclass
specific parameters and the result assigned to the right stream.
|
protected java.io.InputStream |
materializeStream(java.io.InputStream is,
java.lang.String typeDesc) |
Materialize the given stream into memory and update the internal
length variable.
|
(package private) void |
setSqlLength(long length) |
Update the registered length of the Lob value.
|
(package private) long |
sqlLength() |
Return the length of the Lob value represented by this Lob
object.
|
boolean |
willBeLayerBStreamed() |
static final int STRING
static final int ASCII_STREAM
static final int UNICODE_STREAM
static final int CHARACTER_STREAM
static final int BINARY_STREAM
static final int BINARY_STRING
static final int LOCATOR
public static final int INVALID_LOCATOR
protected Agent agent_
protected int dataType_
protected int locator_
private long sqlLength_
private boolean lengthObtained_
protected boolean isValid_
private final boolean willBeLayerBStreamed_
private long updateCount
private int transactionID_
private static final ClientMessageId LOB_OBJECT_LENGTH_UNKNOWN_YET
protected Lob(Agent agent, boolean willBeLayerBStreamed)
long sqlLength() throws SqlException
SqlException
- on execution errors while materializing the stream,
or if Layer B streaming is used and length not yet obtained.void setSqlLength(long length)
length
- the new length of the Lob valuelong getLocatorLength() throws SqlException
SqlException
public void listenToUnitOfWork()
listenToUnitOfWork
in interface UnitOfWorkListener
public void completeLocalCommit(java.util.Iterator listenerIterator)
completeLocalCommit
in interface UnitOfWorkListener
public void completeLocalRollback(java.util.Iterator listenerIterator)
completeLocalRollback
in interface UnitOfWorkListener
public Agent getAgent()
void checkForClosedConnection() throws SqlException
SqlException
protected abstract void materializeStream() throws SqlException
SqlException
protected java.io.InputStream materializeStream(java.io.InputStream is, java.lang.String typeDesc) throws SqlException
is
- stream to use for inputtypeDesc
- description of the data type we are inserting,
for instance java.sql.Clob
SqlException
- if the stream exceeds 2 GB, or an error happens
while reading from the streampublic abstract long length() throws java.sql.SQLException
java.sql.SQLException
protected static boolean isLayerBStreamingPossible(Agent agent)
public boolean willBeLayerBStreamed()
public boolean isLocator()
public int getLocator()
protected void checkPosAndLength(long pos, long length) throws java.sql.SQLException
pos
and length
.pos
- a long that contains the position that needs to be checkedlength
- a long that contains the length that needs to be checkedjava.sql.SQLException
- if
a) pos <= 0
b) pos > (length of LOB)
c) length < 0
d) (pos -1) + length > (length of LOB)protected void incrementUpdateCount()
Lob
. The method needs to be
synchronized since multiple updates can
happen on this Lob
simultaneously.
It will be called from the
1) Locator Writers
2) Locator OutputStreams
3) From the update methods
within the Lobs like setString, truncate.
since all of the above acesses are inside
the am package, this method will have
default access. We do not need to worry
about the non-locator streams since
non-locator InputStreams would not
depend on updateCount for invalidationlong getUpdateCount()
void checkForLocatorValidity() throws SqlException
SqlException
protected void checkValidity() throws java.sql.SQLException
java.sql.SQLException
- if isValid is not true or the transaction that
created the Lob is not activeApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.