A LOB's state is either unpublished or published. When a LOB is published, it
means that the end-user has been given a reference to the LOB object. This
implies that the LOB cannot be automatically freed/released when the
result set position changes (i.e. typically rs.next()), because the
LOB object must be kept valid/alive until the transaction is ended or the
LOB object is explicitly freed.
This class covers two types of functionality regarding LOBs;
checkCurrentRow is
called.
The tracker has a notion of current row. The current row is changed by
calling checkCurrentRow. The owner of the tracker
is repsonsible for invoking the method at the correct time, and only when
the cursor is positioned on a valid data row. The method must be invoked
before the cursor changes the position. Note that calling the method
discardState makes checkCurrentRow ignore all
LOBs on the subsequent call.
| Modifier and Type | Field and Description |
|---|---|
| private final int[] | columns
1-based column indexes for the LOBs to track. |
| private final boolean | doRelease
Tells whether locators shall be released. |
| private final boolean[] | isBlob
Tells whether the LOB is Blob or a Clob. |
| private final int[] | lastLocatorSeen
The last locator values seen when releasing. |
| public static final LOBStateTracker | NO_OP_TRACKER
Instance to use when there are no LOBs in the result set, or when the server doesn't support locators. |
| private final boolean[] | published
Tells whether the LOB colum has been published for the current row. |
| Access | Constructor and Description |
|---|---|
| pack-priv | LOBStateTracker(int[]
the 1-based indexes of the LOB columns lobIndexes, boolean[] whether the LOB is a Blob or a Clob isBlob, boolean whether locators shall be released doRelease)Creates a LOB state tracker for the specified configuration. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | checkCurrentRow(Cursor
the cursor object to use for releasing the locators cursor)Checks the current row, updating state and releasing locators on the server as required. |
| pack-priv void | |
| pack-priv void | markAsPublished(int
1-based column index index)Marks the specified column of the current row as published, which implies that the tracker should not release the associated locator. |
| columns | back to summary |
|---|---|
| private final int[] columns 1-based column indexes for the LOBs to track. | |
| doRelease | back to summary |
|---|---|
| private final boolean doRelease Tells whether locators shall be released. This will be | |
| isBlob | back to summary |
|---|---|
| private final boolean[] isBlob Tells whether the LOB is Blob or a Clob. | |
| lastLocatorSeen | back to summary |
|---|---|
| private final int[] lastLocatorSeen The last locator values seen when releasing. These values are used to detect if checkCurrentRow is being executed more than once on the same row. | |
| NO_OP_TRACKER | back to summary |
|---|---|
| public static final LOBStateTracker NO_OP_TRACKER Instance to use when there are no LOBs in the result set, or when the server doesn't support locators. | |
| published | back to summary |
|---|---|
| private final boolean[] published Tells whether the LOB colum has been published for the current row. | |
| LOBStateTracker | back to summary |
|---|---|
| pack-priv LOBStateTracker(int[] lobIndexes, boolean[] isBlob, boolean doRelease) Creates a LOB state tracker for the specified configuration.
| |
| checkCurrentRow | back to summary |
|---|---|
| pack-priv void checkCurrentRow(Cursor cursor) throws SqlException Checks the current row, updating state and releasing locators on the server as required. This method should only be called once per valid row in the result set.
| |
| discardState | back to summary |
|---|---|
| pack-priv void discardState() Discards all recorded dynamic state about LOBs. Typically called after connection commit or rollback, as those operations will release all locators on the server automatically. There is no need to release them from the client side in this case. | |
| markAsPublished | back to summary |
|---|---|
| pack-priv void markAsPublished(int index) Marks the specified column of the current row as published, which implies that the tracker should not release the associated locator. Columns must be marked as published when a LOB object is created on the client, to avoid releasing the corresponding locator too early.
| |