Package org.apache.derby.client.net
Class NetCursor
- java.lang.Object
-
- org.apache.derby.client.am.Cursor
-
- org.apache.derby.client.net.NetCursor
-
-
Field Summary
Fields Modifier and Type Field Description (package private) booleanblocking_(package private) java.util.ArrayList<byte[]>extdtaData_Queue to hold EXTDTA data that hasn't been correlated to its column number.(package private) java.util.HashMap<java.lang.Integer,java.lang.Integer>extdtaPositions_(package private) boolean[]isGraphic_(package private) intmaximumRowSize_private NetAgentnetAgent_(package private) NetResultSetnetResultSet_private booleanqryclsimpEnabled_Flag indicating whether the result set on the server is implicitly closed when end-of-data is received.(package private) TypdefqrydscTypdef_(package private) booleanrtnextrow_(package private) int[]typeToUseForComputingDataLength_-
Fields inherited from class org.apache.derby.client.am.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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidadjustColumnOffsetsForColumnsPreviouslyCalculated(int index)Adjust column offsets after fetching the next part of a split row.private int[]allocateColumnDataComputedLengthArray(int row)private boolean[]allocateColumnDataIsNullArray(int row)private int[]allocateColumnDataPositionArray(int row)(package private) voidallocateColumnOffsetAndLengthArrays()protected booleancalculateColumnOffsetsForRow_(int rowIndex, boolean allowServerFetch)Calculate the column offsets for a row.(package private) voidcalculateLobColumnPositionsForRow()private voidcheckAndThrowReceivedEndqryrm()private 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 voidclearLobData_()private intcompleteSplitRow(int index)Fetch more data for a row that has been split up.private byte[]findExtdtaData(int column)ClientBlobgetBlobColumn_(int column, Agent agent, boolean toBePublished)Returns aBlobobject.ClientClobgetClobColumn_(int column, Agent agent, boolean toBePublished)Returns aClobobject.protected intgetDecimalLength(int index)protected voidgetMoreData_()(package private) booleangetQryclsimpEnabled()Check 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 columnvoidnullDataForGC()private NetSqlca[]parseSQLCAGRP(Typdef typdef)private NetSqlca[]parseSQLCARD(Typdef typdef)private voidparseSQLCAXGRP(Typdef typdef, NetSqlca netSqlca)private NetSqlcaparseSQLDCGRP()private NetSqlcaparseSQLDCROW()private voidparseSQLDCTOKS()private voidparseSQLDCXGRP()private NetSqlca[]parseSQLDIAGCI()private voidparseSQLDIAGCN()private NetSqlca[]parseSQLDIAGGRP()private voidparseSQLDIAGSTT()private java.lang.StringparseVCS(Typdef typdefInEffect)private byte[]readFdocaBytes(int length)private intreadFdocaInt()private intreadFdocaOneByte()private intreadFdocaOneByte(int index)private java.lang.StringreadFdocaString(int length, java.nio.charset.Charset encoding)private intreadFdocaTwoByteLength()private intreadFdocaTwoByteLength(int index)private voidresetCurrentRowPosition()(package private) voidscanDataBufferForEndOfData()Scan the data buffer to see if end of data (SQL state 02000) has been received.voidsetAllRowsReceivedFromServer(boolean b)Set the value of value of allRowsReceivedFromServer_.(package private) voidsetQryclsimpEnabled(boolean flag)Set a flag indicating whether QRYCLSIMP is enabled.private voidshiftPartialRowToBeginning()private intskipFdocaBytes(int length)private intskipFdocaBytes(int length, int index)-
Methods inherited from class org.apache.derby.client.am.Cursor
allocateCharBuffer, allRowsReceivedFromServer, get_INTEGER, getIsRowUpdated, getIsUpdateDeleteHole, incrementRowsReadEvent, makeNextRowPositionCurrent, markNextRowPosition, next, resetDataBuffer, setIsRowUpdated, setIsUpdataDeleteHole, setNumberOfColumns, stepNext
-
-
-
-
Field Detail
-
netResultSet_
NetResultSet netResultSet_
-
netAgent_
private NetAgent netAgent_
-
qrydscTypdef_
Typdef qrydscTypdef_
-
maximumRowSize_
int maximumRowSize_
-
blocking_
boolean blocking_
-
typeToUseForComputingDataLength_
int[] typeToUseForComputingDataLength_
-
isGraphic_
boolean[] isGraphic_
-
extdtaPositions_
java.util.HashMap<java.lang.Integer,java.lang.Integer> extdtaPositions_
-
extdtaData_
java.util.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.
-
-
Method Detail
-
calculateColumnOffsetsForRow_
protected boolean calculateColumnOffsetsForRow_(int rowIndex, boolean allowServerFetch) throws SqlException, DisconnectExceptionCalculate 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
void scanDataBufferForEndOfData() throws SqlExceptionScan 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
private int readFdocaInt() throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
readFdocaOneByte
private int readFdocaOneByte() throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
readFdocaOneByte
private int readFdocaOneByte(int index) throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
readFdocaBytes
private byte[] readFdocaBytes(int length) throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
readFdocaTwoByteLength
private int readFdocaTwoByteLength() throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
readFdocaTwoByteLength
private int readFdocaTwoByteLength(int index) throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
skipFdocaBytes
private int skipFdocaBytes(int length) throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
skipFdocaBytes
private int skipFdocaBytes(int length, int index) throws DisconnectException, SqlException- 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
private NetSqlca[] parseSQLCARD(Typdef typdef) throws DisconnectException, SqlException
- Throws:
DisconnectExceptionSqlException
-
parseSQLCAGRP
private NetSqlca[] parseSQLCAGRP(Typdef typdef) throws DisconnectException, SqlException
- Throws:
DisconnectExceptionSqlException
-
parseSQLCAXGRP
private void parseSQLCAXGRP(Typdef typdef, NetSqlca netSqlca) throws DisconnectException, SqlException
- Throws:
DisconnectExceptionSqlException
-
parseSQLDIAGGRP
private NetSqlca[] parseSQLDIAGGRP() throws DisconnectException, SqlException
- Throws:
DisconnectExceptionSqlException
-
parseSQLDIAGSTT
private void parseSQLDIAGSTT() throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
parseSQLDIAGCI
private NetSqlca[] parseSQLDIAGCI() throws DisconnectException, SqlException
- Throws:
DisconnectExceptionSqlException
-
parseSQLDIAGCN
private void parseSQLDIAGCN() throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
parseSQLDCGRP
private NetSqlca parseSQLDCGRP() throws DisconnectException, SqlException
- Throws:
DisconnectExceptionSqlException
-
parseSQLDCROW
private NetSqlca parseSQLDCROW() throws DisconnectException, SqlException
- Throws:
DisconnectExceptionSqlException
-
parseSQLDCTOKS
private void parseSQLDCTOKS() throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
parseSQLDCXGRP
private void parseSQLDCXGRP() throws DisconnectException, SqlException- Throws:
DisconnectExceptionSqlException
-
parseVCS
private java.lang.String parseVCS(Typdef typdefInEffect) throws DisconnectException, SqlException
- Throws:
DisconnectExceptionSqlException
-
readFdocaString
private java.lang.String readFdocaString(int length, java.nio.charset.Charset encoding) throws SqlException- 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:
Cursor.getBlobColumn_(int, org.apache.derby.client.am.Agent, boolean)
-
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:
Cursor.getClobColumn_(int, org.apache.derby.client.am.Agent, boolean)
-
initializeColumnInfoArrays
void initializeColumnInfoArrays(Typdef typdef, int columnCount) throws DisconnectException
- Throws:
DisconnectException
-
getMoreData_
protected void getMoreData_() throws SqlException- Specified by:
getMoreData_in classCursor- Throws:
SqlException
-
nullDataForGC
public void nullDataForGC()
- Overrides:
nullDataForGCin classCursor
-
checkForSplitRowAndComplete
private void checkForSplitRowAndComplete(int length, int index) throws SqlExceptionCheck 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
private void checkForSplitRowAndComplete(int length) throws SqlExceptionCheck 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
private void checkAndThrowReceivedEndqryrm() throws SqlException- Throws:
SqlException
-
checkAndThrowReceivedEndqryrm
private void checkAndThrowReceivedEndqryrm(int lastValidBytePositionBeforeFetch) throws SqlException- Throws:
SqlException
-
completeSplitRow
private int completeSplitRow(int index) throws DisconnectException, SqlExceptionFetch 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
-
-