Class NetCursor
java.lang.Object
org.apache.derby.client.am.Cursor
org.apache.derby.client.net.NetCursor
- Direct Known Subclasses:
NetSqldta
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean(package private) ArrayList<byte[]> Queue to hold EXTDTA data that hasn't been correlated to its column number.(package private) boolean[](package private) intprivate NetAgent(package private) NetResultSetprivate booleanFlag indicating whether the result set on the server is implicitly closed when end-of-data is received.(package private) Typdef(package private) boolean(package private) int[]Fields inherited from class Cursor
agent_, BYTES, ccsid_, charset_, columnDataComputedLength_, columnDataIsNullCache_, columnDataLengthCache_, columnDataPosition_, columnDataPositionCache_, columns_, currentRowPosition_, dataBuffer_, dataBufferStream_, fdocaLength_, hasLobs_, isNull_, jdbcTypes_, lastValidBytePosition_, NULL_TERMINATED_BYTES, NULL_TERMINATED_STRING, nullable_, position_, STRING, VARIABLE_SHORT_STRING, VARIABLE_STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidAdjust column offsets after fetching the next part of a split row.private int[]private boolean[]allocateColumnDataIsNullArray(int row) private int[]allocateColumnDataPositionArray(int row) (package private) voidprotected booleancalculateColumnOffsetsForRow_(int rowIndex, boolean allowServerFetch) Calculate the column offsets for a row.(package private) voidprivate voidprivate voidcheckAndThrowReceivedEndqryrm(int lastValidBytePositionBeforeFetch) private voidcheckForSplitRowAndComplete(int length) Check if the data we want crosses a row split, and fetch more data if necessary.private voidcheckForSplitRowAndComplete(int length, int index) Check if the data we want crosses a row split, and fetch more data if necessary.protected voidprivate intcompleteSplitRow(int index) Fetch more data for a row that has been split up.private byte[]findExtdtaData(int column) getBlobColumn_(int column, Agent agent, boolean toBePublished) Returns aBlobobject.getClobColumn_(int column, Agent agent, boolean toBePublished) Returns aClobobject.protected intgetDecimalLength(int index) protected void(package private) final booleanCheck whether QRYCLSIMP is enabled on this cursor.(package private) voidinitializeColumnInfoArrays(Typdef typdef, int columnCount) private booleanisNonTrivialDataLob(int index) protected intlocator(int column) Get locator for LOB of the designated columnvoidprivate NetSqlca[]parseSQLCAGRP(Typdef typdef) private NetSqlca[]parseSQLCARD(Typdef typdef) private voidparseSQLCAXGRP(Typdef typdef, NetSqlca netSqlca) private NetSqlcaprivate NetSqlcaprivate voidprivate voidprivate NetSqlca[]private voidprivate NetSqlca[]private voidprivate Stringprivate byte[]readFdocaBytes(int length) private intprivate intprivate intreadFdocaOneByte(int index) private StringreadFdocaString(int length, Charset encoding) private intprivate intreadFdocaTwoByteLength(int index) private void(package private) voidScan the data buffer to see if end of data (SQL state 02000) has been received.final voidsetAllRowsReceivedFromServer(boolean b) Set the value of value of allRowsReceivedFromServer_.(package private) final voidsetQryclsimpEnabled(boolean flag) Set a flag indicating whether QRYCLSIMP is enabled.private voidprivate intskipFdocaBytes(int length) private intskipFdocaBytes(int length, int index) Methods inherited from class Cursor
allocateCharBuffer, allRowsReceivedFromServer, get_INTEGER, getIsRowUpdated, getIsUpdateDeleteHole, incrementRowsReadEvent, makeNextRowPositionCurrent, markNextRowPosition, next, resetDataBuffer, setIsRowUpdated, setIsUpdataDeleteHole, setNumberOfColumns, stepNext
-
Field Details
-
netResultSet_
NetResultSet netResultSet_ -
netAgent_
-
qrydscTypdef_
Typdef qrydscTypdef_ -
maximumRowSize_
int maximumRowSize_ -
blocking_
boolean blocking_ -
typeToUseForComputingDataLength_
int[] typeToUseForComputingDataLength_ -
isGraphic_
boolean[] isGraphic_ -
extdtaPositions_
-
extdtaData_
ArrayList<byte[]> extdtaData_Queue to hold EXTDTA data that hasn't been correlated to its column number. -
rtnextrow_
boolean rtnextrow_ -
qryclsimpEnabled_
private boolean qryclsimpEnabled_Flag indicating whether the result set on the server is implicitly closed when end-of-data is received.
-
-
Constructor Details
-
Method Details
-
calculateColumnOffsetsForRow_
protected boolean calculateColumnOffsetsForRow_(int rowIndex, boolean allowServerFetch) throws SqlException, DisconnectException Calculate the column offsets for a row.Pseudo-code:
- parse thru the current row in dataBuffer computing column offsets
- if (we hit the super.lastValidBytePosition, ie. encounter
partial row)
- shift partial row bytes to beginning of dataBuffer (this.shiftPartialRowToBeginning())
- reset current row position (also done by this.shiftPartialRowToBeginning())
- send and recv continue-query into commBuffer (rs.flowContinueQuery())
- parse commBuffer up to QRYDTA (rs.flowContinueQuery())
- copy query data from reply's commBuffer to our dataBuffer (this.copyQrydta())
- Specified by:
calculateColumnOffsetsForRow_in classCursor- Parameters:
rowIndex- row indexallowServerFetch- if true, allow fetching more data from server- Returns:
trueif the current row position is a valid row position.- Throws:
SqlExceptionDisconnectException
-
scanDataBufferForEndOfData
Scan the data buffer to see if end of data (SQL state 02000) has been received. This method should only be called when the cursor is being closed since the pointer to the current row can be modified.- Throws:
SqlException
-
readFdocaInt
- Throws:
DisconnectExceptionSqlException
-
readFdocaOneByte
- Throws:
DisconnectExceptionSqlException
-
readFdocaOneByte
- Throws:
DisconnectExceptionSqlException
-
readFdocaBytes
- Throws:
DisconnectExceptionSqlException
-
readFdocaTwoByteLength
- Throws:
DisconnectExceptionSqlException
-
readFdocaTwoByteLength
- Throws:
DisconnectExceptionSqlException
-
skipFdocaBytes
- Throws:
DisconnectExceptionSqlException
-
skipFdocaBytes
- Throws:
DisconnectExceptionSqlException
-
shiftPartialRowToBeginning
private void shiftPartialRowToBeginning() -
adjustColumnOffsetsForColumnsPreviouslyCalculated
private void adjustColumnOffsetsForColumnsPreviouslyCalculated(int index) Adjust column offsets after fetching the next part of a split row.- Parameters:
index- the index of the column that was split, or -1 when not fetching column data
-
resetCurrentRowPosition
private void resetCurrentRowPosition() -
calculateLobColumnPositionsForRow
void calculateLobColumnPositionsForRow() -
isNonTrivialDataLob
private boolean isNonTrivialDataLob(int index) -
clearLobData_
protected void clearLobData_()- Specified by:
clearLobData_in classCursor
-
parseSQLCARD
- Throws:
DisconnectExceptionSqlException
-
parseSQLCAGRP
- Throws:
DisconnectExceptionSqlException
-
parseSQLCAXGRP
private void parseSQLCAXGRP(Typdef typdef, NetSqlca netSqlca) throws DisconnectException, SqlException - Throws:
DisconnectExceptionSqlException
-
parseSQLDIAGGRP
- Throws:
DisconnectExceptionSqlException
-
parseSQLDIAGSTT
- Throws:
DisconnectExceptionSqlException
-
parseSQLDIAGCI
- Throws:
DisconnectExceptionSqlException
-
parseSQLDIAGCN
- Throws:
DisconnectExceptionSqlException
-
parseSQLDCGRP
- Throws:
DisconnectExceptionSqlException
-
parseSQLDCROW
- Throws:
DisconnectExceptionSqlException
-
parseSQLDCTOKS
- Throws:
DisconnectExceptionSqlException
-
parseSQLDCXGRP
- Throws:
DisconnectExceptionSqlException
-
parseVCS
- Throws:
DisconnectExceptionSqlException
-
readFdocaString
- Throws:
SqlException
-
allocateColumnOffsetAndLengthArrays
void allocateColumnOffsetAndLengthArrays() -
findExtdtaData
private byte[] findExtdtaData(int column) -
locator
protected int locator(int column) Get locator for LOB of the designated columnNote that this method cannot be invoked on a LOB column that is NULL.
-
getBlobColumn_
public ClientBlob getBlobColumn_(int column, Agent agent, boolean toBePublished) throws SqlException Description copied from class:CursorReturns aBlobobject.- Specified by:
getBlobColumn_in classCursor- Parameters:
column- 1-based column indexagent- associated agenttoBePublished- whether the Blob will be published to the user- Returns:
- A Blob object.
- Throws:
SqlException- if getting theBlobfails- See Also:
-
getClobColumn_
public ClientClob getClobColumn_(int column, Agent agent, boolean toBePublished) throws SqlException Description copied from class:CursorReturns aClobobject.- Specified by:
getClobColumn_in classCursor- Parameters:
column- 1-based column indexagent- associated agenttoBePublished- whether the Clob will be published to the user- Returns:
- A
java.sql.Clobobject. - Throws:
SqlException- if getting theClobfails- See Also:
-
initializeColumnInfoArrays
- Throws:
DisconnectException
-
getMoreData_
- Specified by:
getMoreData_in classCursor- Throws:
SqlException
-
nullDataForGC
public void nullDataForGC()- Overrides:
nullDataForGCin classCursor
-
checkForSplitRowAndComplete
Check if the data we want crosses a row split, and fetch more data if necessary.- Parameters:
length- the length in bytes of the data neededindex- the index of the column to be fetched, or -1 when not fetching column data- Throws:
SqlException
-
checkForSplitRowAndComplete
Check if the data we want crosses a row split, and fetch more data if necessary. This method is not for column data; usecheckForSplitRowAndComplete(int, int)for that.- Parameters:
length- the length in bytes of the data needed- Throws:
SqlException
-
checkAndThrowReceivedEndqryrm
- Throws:
SqlException
-
checkAndThrowReceivedEndqryrm
private void checkAndThrowReceivedEndqryrm(int lastValidBytePositionBeforeFetch) throws SqlException - Throws:
SqlException
-
completeSplitRow
Fetch more data for a row that has been split up.- Parameters:
index- the index of the column that was split, or -1 when not fetching column data- Returns:
- the value of
lastValidBytePosition_before more data was fetched - Throws:
DisconnectExceptionSqlException
-
allocateColumnDataPositionArray
private int[] allocateColumnDataPositionArray(int row) -
allocateColumnDataComputedLengthArray
private int[] allocateColumnDataComputedLengthArray(int row) -
allocateColumnDataIsNullArray
private boolean[] allocateColumnDataIsNullArray(int row) -
getDecimalLength
protected int getDecimalLength(int index) -
setAllRowsReceivedFromServer
public final void setAllRowsReceivedFromServer(boolean b) Set the value of value of allRowsReceivedFromServer_.- Overrides:
setAllRowsReceivedFromServerin classCursor- Parameters:
b- abooleanvalue indicating whether all rows are received from the server
-
setQryclsimpEnabled
final void setQryclsimpEnabled(boolean flag) Set a flag indicating whether QRYCLSIMP is enabled.- Parameters:
flag- true if QRYCLSIMP is enabled
-
getQryclsimpEnabled
final boolean getQryclsimpEnabled()Check whether QRYCLSIMP is enabled on this cursor.- Returns:
- true if QRYCLSIMP is enabled
-