Package org.apache.derby.client.net
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) int
private NetAgent
(package private) NetResultSet
private boolean
Flag 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 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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Adjust 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) void
protected boolean
calculateColumnOffsetsForRow_
(int rowIndex, boolean allowServerFetch) Calculate the column offsets for a row.(package private) void
private void
private void
checkAndThrowReceivedEndqryrm
(int lastValidBytePositionBeforeFetch) private void
checkForSplitRowAndComplete
(int length) Check if the data we want crosses a row split, and fetch more data if necessary.private void
checkForSplitRowAndComplete
(int length, int index) Check if the data we want crosses a row split, and fetch more data if necessary.protected void
private int
completeSplitRow
(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 aBlob
object.getClobColumn_
(int column, Agent agent, boolean toBePublished) Returns aClob
object.protected int
getDecimalLength
(int index) protected void
(package private) final boolean
Check whether QRYCLSIMP is enabled on this cursor.(package private) void
initializeColumnInfoArrays
(Typdef typdef, int columnCount) private boolean
isNonTrivialDataLob
(int index) protected int
locator
(int column) Get locator for LOB of the designated columnvoid
private NetSqlca[]
parseSQLCAGRP
(Typdef typdef) private NetSqlca[]
parseSQLCARD
(Typdef typdef) private void
parseSQLCAXGRP
(Typdef typdef, NetSqlca netSqlca) private NetSqlca
private NetSqlca
private void
private void
private NetSqlca[]
private void
private NetSqlca[]
private void
private String
private byte[]
readFdocaBytes
(int length) private int
private int
private int
readFdocaOneByte
(int index) private String
readFdocaString
(int length, Charset encoding) private int
private int
readFdocaTwoByteLength
(int index) private void
(package private) void
Scan the data buffer to see if end of data (SQL state 02000) has been received.final void
setAllRowsReceivedFromServer
(boolean b) Set the value of value of allRowsReceivedFromServer_.(package private) final void
setQryclsimpEnabled
(boolean flag) Set a flag indicating whether QRYCLSIMP is enabled.private void
private int
skipFdocaBytes
(int length) private int
skipFdocaBytes
(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 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:
true
if the current row position is a valid row position.- Throws:
SqlException
DisconnectException
-
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:
DisconnectException
SqlException
-
readFdocaOneByte
- Throws:
DisconnectException
SqlException
-
readFdocaOneByte
- Throws:
DisconnectException
SqlException
-
readFdocaBytes
- Throws:
DisconnectException
SqlException
-
readFdocaTwoByteLength
- Throws:
DisconnectException
SqlException
-
readFdocaTwoByteLength
- Throws:
DisconnectException
SqlException
-
skipFdocaBytes
- Throws:
DisconnectException
SqlException
-
skipFdocaBytes
- Throws:
DisconnectException
SqlException
-
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:
DisconnectException
SqlException
-
parseSQLCAGRP
- Throws:
DisconnectException
SqlException
-
parseSQLCAXGRP
private void parseSQLCAXGRP(Typdef typdef, NetSqlca netSqlca) throws DisconnectException, SqlException - Throws:
DisconnectException
SqlException
-
parseSQLDIAGGRP
- Throws:
DisconnectException
SqlException
-
parseSQLDIAGSTT
- Throws:
DisconnectException
SqlException
-
parseSQLDIAGCI
- Throws:
DisconnectException
SqlException
-
parseSQLDIAGCN
- Throws:
DisconnectException
SqlException
-
parseSQLDCGRP
- Throws:
DisconnectException
SqlException
-
parseSQLDCROW
- Throws:
DisconnectException
SqlException
-
parseSQLDCTOKS
- Throws:
DisconnectException
SqlException
-
parseSQLDCXGRP
- Throws:
DisconnectException
SqlException
-
parseVCS
- Throws:
DisconnectException
SqlException
-
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:Cursor
Returns aBlob
object.- 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 theBlob
fails- See Also:
-
getClobColumn_
public ClientClob getClobColumn_(int column, Agent agent, boolean toBePublished) throws SqlException Description copied from class:Cursor
Returns aClob
object.- 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.Clob
object. - Throws:
SqlException
- if getting theClob
fails- See Also:
-
initializeColumnInfoArrays
- Throws:
DisconnectException
-
getMoreData_
- Specified by:
getMoreData_
in classCursor
- Throws:
SqlException
-
nullDataForGC
public void nullDataForGC()- Overrides:
nullDataForGC
in 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:
DisconnectException
SqlException
-
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:
setAllRowsReceivedFromServer
in classCursor
- Parameters:
b
- aboolean
value 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
-