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) boolean
blocking_
(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) int
maximumRowSize_
private NetAgent
netAgent_
(package private) NetResultSet
netResultSet_
private boolean
qryclsimpEnabled_
Flag indicating whether the result set on the server is implicitly closed when end-of-data is received.(package private) Typdef
qrydscTypdef_
(package private) boolean
rtnextrow_
(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 void
adjustColumnOffsetsForColumnsPreviouslyCalculated(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) void
allocateColumnOffsetAndLengthArrays()
protected boolean
calculateColumnOffsetsForRow_(int rowIndex, boolean allowServerFetch)
Calculate the column offsets for a row.(package private) void
calculateLobColumnPositionsForRow()
private void
checkAndThrowReceivedEndqryrm()
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
clearLobData_()
private int
completeSplitRow(int index)
Fetch more data for a row that has been split up.private byte[]
findExtdtaData(int column)
ClientBlob
getBlobColumn_(int column, Agent agent, boolean toBePublished)
Returns aBlob
object.ClientClob
getClobColumn_(int column, Agent agent, boolean toBePublished)
Returns aClob
object.protected int
getDecimalLength(int index)
protected void
getMoreData_()
(package private) boolean
getQryclsimpEnabled()
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
nullDataForGC()
private NetSqlca[]
parseSQLCAGRP(Typdef typdef)
private NetSqlca[]
parseSQLCARD(Typdef typdef)
private void
parseSQLCAXGRP(Typdef typdef, NetSqlca netSqlca)
private NetSqlca
parseSQLDCGRP()
private NetSqlca
parseSQLDCROW()
private void
parseSQLDCTOKS()
private void
parseSQLDCXGRP()
private NetSqlca[]
parseSQLDIAGCI()
private void
parseSQLDIAGCN()
private NetSqlca[]
parseSQLDIAGGRP()
private void
parseSQLDIAGSTT()
private java.lang.String
parseVCS(Typdef typdefInEffect)
private byte[]
readFdocaBytes(int length)
private int
readFdocaInt()
private int
readFdocaOneByte()
private int
readFdocaOneByte(int index)
private java.lang.String
readFdocaString(int length, java.nio.charset.Charset encoding)
private int
readFdocaTwoByteLength()
private int
readFdocaTwoByteLength(int index)
private void
resetCurrentRowPosition()
(package private) void
scanDataBufferForEndOfData()
Scan the data buffer to see if end of data (SQL state 02000) has been received.void
setAllRowsReceivedFromServer(boolean b)
Set the value of value of allRowsReceivedFromServer_.(package private) void
setQryclsimpEnabled(boolean flag)
Set a flag indicating whether QRYCLSIMP is enabled.private void
shiftPartialRowToBeginning()
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 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, 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
void scanDataBufferForEndOfData() throws SqlException
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
private int readFdocaInt() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
readFdocaOneByte
private int readFdocaOneByte() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
readFdocaOneByte
private int readFdocaOneByte(int index) throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
readFdocaBytes
private byte[] readFdocaBytes(int length) throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
readFdocaTwoByteLength
private int readFdocaTwoByteLength() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
readFdocaTwoByteLength
private int readFdocaTwoByteLength(int index) throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
skipFdocaBytes
private int skipFdocaBytes(int length) throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
skipFdocaBytes
private int skipFdocaBytes(int length, int index) throws DisconnectException, SqlException
- 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
private NetSqlca[] parseSQLCARD(Typdef typdef) throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseSQLCAGRP
private NetSqlca[] parseSQLCAGRP(Typdef typdef) throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseSQLCAXGRP
private void parseSQLCAXGRP(Typdef typdef, NetSqlca netSqlca) throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseSQLDIAGGRP
private NetSqlca[] parseSQLDIAGGRP() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseSQLDIAGSTT
private void parseSQLDIAGSTT() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseSQLDIAGCI
private NetSqlca[] parseSQLDIAGCI() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseSQLDIAGCN
private void parseSQLDIAGCN() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseSQLDCGRP
private NetSqlca parseSQLDCGRP() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseSQLDCROW
private NetSqlca parseSQLDCROW() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseSQLDCTOKS
private void parseSQLDCTOKS() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseSQLDCXGRP
private void parseSQLDCXGRP() throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
parseVCS
private java.lang.String parseVCS(Typdef typdefInEffect) throws DisconnectException, SqlException
- Throws:
DisconnectException
SqlException
-
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: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:
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: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:
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:
nullDataForGC
in classCursor
-
checkForSplitRowAndComplete
private void checkForSplitRowAndComplete(int length, int index) throws SqlException
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
private void checkForSplitRowAndComplete(int length) throws SqlException
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
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, SqlException
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
-
-