Top Fields Constructors Methods
org.apache.derby.client.net

pack-priv Class NetCursor

extends Cursor
Class Inheritance
Known Direct Subclasses
org.apache.derby.client.net.NetSqldta
Imports
java.nio.charset.Charset, java.sql.ResultSet, java.util.ArrayList, .HashMap, org.apache.derby.client.am.Agent, .ClientBlob, .ClientMessageId, .ClientClob, .Cursor, .DisconnectException, .Lob, .SignedBinary, .SqlCode, .SqlException, .SqlWarning, .ClientTypes, .Utils, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.sanity.SanityManager

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv ArrayList<byte[]>
extdtaData_

Queue to hold EXTDTA data that hasn't been correlated to its column number.

pack-priv HashMap<Integer, Integer>
pack-priv boolean[]
pack-priv int
private NetAgent
pack-priv NetResultSet
private boolean
qryclsimpEnabled_

Flag indicating whether the result set on the server is implicitly closed when end-of-data is received.

pack-priv Typdef
pack-priv boolean
pack-priv int[]
Inherited from org.apache.derby.client.am.Cursor:
agent_BYTESccsid_charset_columnDataComputedLength_columnDataIsNullCache_columnDataLengthCache_columnDataPosition_columnDataPositionCache_columns_currentRowPosition_dataBuffer_dataBufferStream_fdocaLength_hasLobs_isNull_jdbcTypes_lastValidBytePosition_NULL_TERMINATED_BYTESNULL_TERMINATED_STRINGnullable_position_STRINGVARIABLE_SHORT_STRINGVARIABLE_STRING

Constructor Summary

AccessConstructor and Description
pack-priv
NetCursor(NetAgent netAgent)

pack-priv
NetCursor(NetAgent netAgent, int qryprctyp)

Method Summary

Modifier and TypeMethod and Description
private void
adjustColumnOffsetsForColumnsPreviouslyCalculated(int
the index of the column that was split, or -1 when not fetching column data
index
)

Adjust column offsets after fetching the next part of a split row.

private int[]
private boolean[]
private int[]
pack-priv void
protected boolean

Returns:

true if the current row position is a valid row position.
calculateColumnOffsetsForRow_
(int
row index
rowIndex
,
boolean
if true, allow fetching more data from server
allowServerFetch
)

Implements abstract org.apache.derby.client.am.Cursor.calculateColumnOffsetsForRow_.

Calculate the column offsets for a row.
pack-priv void
private void
private void
checkAndThrowReceivedEndqryrm(int lastValidBytePositionBeforeFetch)

private void
checkForSplitRowAndComplete(int
the length in bytes of the data needed
length
,
int
the index of the column to be fetched, or -1 when not fetching column data
index
)

Check if the data we want crosses a row split, and fetch more data if necessary.

private void
checkForSplitRowAndComplete(int
the length in bytes of the data needed
length
)

Check if the data we want crosses a row split, and fetch more data if necessary.

protected void
private int

Returns:

the value of lastValidBytePosition_ before more data was fetched
completeSplitRow
(int
the index of the column that was split, or -1 when not fetching column data
index
)

Fetch more data for a row that has been split up.

private byte[]
findExtdtaData(int column)

public ClientBlob
getBlobColumn_(int
1-based column index
column
,
Agent
associated agent
agent
,
boolean
whether the Blob will be published to the user
toBePublished
)

Implements abstract org.apache.derby.client.am.Cursor.getBlobColumn_.

Returns a Blob object.
public ClientClob
getClobColumn_(int
1-based column index
column
,
Agent
associated agent
agent
,
boolean
whether the Clob will be published to the user
toBePublished
)

Implements abstract org.apache.derby.client.am.Cursor.getClobColumn_.

Returns a Clob object.
protected int
getDecimalLength(int index)

protected void
pack-priv final boolean

Returns:

true if QRYCLSIMP is enabled
getQryclsimpEnabled
()

Check whether QRYCLSIMP is enabled on this cursor.

pack-priv void
initializeColumnInfoArrays(Typdef typdef, int columnCount)

private boolean
protected int

Returns:

locator value, Lob.INVALID_LOCATOR if LOB value was sent instead of locator
locator
(int
column number, starts at 1
column
)

Implements abstract org.apache.derby.client.am.Cursor.locator.

Get locator for LOB of the designated column

Note that this method cannot be invoked on a LOB column that is NULL.

public void
private NetSqlca[]
private NetSqlca[]
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
parseVCS(Typdef typdefInEffect)

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
private void
pack-priv void
scanDataBufferForEndOfData()

Scan the data buffer to see if end of data (SQL state 02000) has been received.

public final void
setAllRowsReceivedFromServer(boolean
a boolean value indicating whether all rows are received from the server
b
)

Overrides org.apache.derby.client.am.Cursor.setAllRowsReceivedFromServer.

Set the value of value of allRowsReceivedFromServer_.
pack-priv final void
setQryclsimpEnabled(boolean
true if QRYCLSIMP is enabled
flag
)

Set a flag indicating whether QRYCLSIMP is enabled.

private void
private int
skipFdocaBytes(int length)

private int
skipFdocaBytes(int length, int index)

Inherited from org.apache.derby.client.am.Cursor:
allocateCharBufferallRowsReceivedFromServerget_INTEGERgetIsRowUpdatedgetIsUpdateDeleteHoleincrementRowsReadEventmakeNextRowPositionCurrentmarkNextRowPositionnextresetDataBuffersetIsRowUpdatedsetIsUpdataDeleteHolesetNumberOfColumnsstepNext

Field Detail

blocking_back to summary
pack-priv boolean blocking_
extdtaData_back to summary
pack-priv ArrayList<byte[]> extdtaData_

Queue to hold EXTDTA data that hasn't been correlated to its column number.

extdtaPositions_back to summary
pack-priv HashMap<Integer, Integer> extdtaPositions_
isGraphic_back to summary
pack-priv boolean[] isGraphic_
maximumRowSize_back to summary
pack-priv int maximumRowSize_
netAgent_back to summary
private NetAgent netAgent_
netResultSet_back to summary
pack-priv NetResultSet netResultSet_
qryclsimpEnabled_back to summary
private boolean qryclsimpEnabled_

Flag indicating whether the result set on the server is implicitly closed when end-of-data is received.

qrydscTypdef_back to summary
pack-priv Typdef qrydscTypdef_
rtnextrow_back to summary
pack-priv boolean rtnextrow_
typeToUseForComputingDataLength_back to summary
pack-priv int[] typeToUseForComputingDataLength_

Constructor Detail

NetCursorback to summary
pack-priv NetCursor(NetAgent netAgent)
NetCursorback to summary
pack-priv NetCursor(NetAgent netAgent, int qryprctyp)

Method Detail

adjustColumnOffsetsForColumnsPreviouslyCalculatedback to summary
private void adjustColumnOffsetsForColumnsPreviouslyCalculated(int index)

Adjust column offsets after fetching the next part of a split row.

Parameters
index:int

the index of the column that was split, or -1 when not fetching column data

allocateColumnDataComputedLengthArrayback to summary
private int[] allocateColumnDataComputedLengthArray(int row)
allocateColumnDataIsNullArrayback to summary
private boolean[] allocateColumnDataIsNullArray(int row)
allocateColumnDataPositionArrayback to summary
private int[] allocateColumnDataPositionArray(int row)
allocateColumnOffsetAndLengthArraysback to summary
pack-priv void allocateColumnOffsetAndLengthArrays()
calculateColumnOffsetsForRow_back to summary
protected boolean calculateColumnOffsetsForRow_(int rowIndex, boolean allowServerFetch) throws SqlException, DisconnectException

Implements abstract org.apache.derby.client.am.Cursor.calculateColumnOffsetsForRow_.

Calculate the column offsets for a row.

Pseudo-code:

  1. parse thru the current row in dataBuffer computing column offsets
  2. if (we hit the super.lastValidBytePosition, ie. encounter partial row)
    1. shift partial row bytes to beginning of dataBuffer (this.shiftPartialRowToBeginning())
    2. reset current row position (also done by this.shiftPartialRowToBeginning())
    3. send and recv continue-query into commBuffer (rs.flowContinueQuery())
    4. parse commBuffer up to QRYDTA (rs.flowContinueQuery())
    5. copy query data from reply's commBuffer to our dataBuffer (this.copyQrydta())
Parameters
rowIndex:int

row index

allowServerFetch:boolean

if true, allow fetching more data from server

Returns:boolean

true if the current row position is a valid row position.

Exceptions
SqlException:

Doc from org.apache.derby.client.am.Cursor.calculateColumnOffsetsForRow_.

on error

DisconnectException:

Doc from org.apache.derby.client.am.Cursor.calculateColumnOffsetsForRow_.

on error

calculateLobColumnPositionsForRowback to summary
pack-priv void calculateLobColumnPositionsForRow()
checkAndThrowReceivedEndqryrmback to summary
private void checkAndThrowReceivedEndqryrm() throws SqlException
checkAndThrowReceivedEndqryrmback to summary
private void checkAndThrowReceivedEndqryrm(int lastValidBytePositionBeforeFetch) throws SqlException
checkForSplitRowAndCompleteback to summary
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:int

the length in bytes of the data needed

index:int

the index of the column to be fetched, or -1 when not fetching column data

checkForSplitRowAndCompleteback to summary
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; use checkForSplitRowAndComplete(int, int) for that.

Parameters
length:int

the length in bytes of the data needed

clearLobData_back to summary
protected void clearLobData_()

Implements abstract org.apache.derby.client.am.Cursor.clearLobData_.

completeSplitRowback to summary
private int completeSplitRow(int index) throws DisconnectException, SqlException

Fetch more data for a row that has been split up.

Parameters
index:int

the index of the column that was split, or -1 when not fetching column data

Returns:int

the value of lastValidBytePosition_ before more data was fetched

findExtdtaDataback to summary
private byte[] findExtdtaData(int column)
getBlobColumn_back to summary
public ClientBlob getBlobColumn_(int column, Agent agent, boolean toBePublished) throws SqlException

Implements abstract org.apache.derby.client.am.Cursor.getBlobColumn_.

Doc from org.apache.derby.client.am.Cursor.getBlobColumn_.

Returns a Blob object.

Parameters
column:int

1-based column index

agent:Agent

associated agent

toBePublished:boolean

whether the Blob will be published to the user

Returns:ClientBlob

A Blob object.

Exceptions
SqlException:
if getting the Blob fails
See Also
org.apache.derby.client.am.Cursor#getBlobColumn_
getClobColumn_back to summary
public ClientClob getClobColumn_(int column, Agent agent, boolean toBePublished) throws SqlException

Implements abstract org.apache.derby.client.am.Cursor.getClobColumn_.

Doc from org.apache.derby.client.am.Cursor.getClobColumn_.

Returns a Clob object.

Parameters
column:int

1-based column index

agent:Agent

associated agent

toBePublished:boolean

whether the Clob will be published to the user

Returns:ClientClob

A java.sql.Clob object.

Exceptions
SqlException:
if getting the Clob fails
See Also
org.apache.derby.client.am.Cursor#getClobColumn_
getDecimalLengthback to summary
protected int getDecimalLength(int index)
getMoreData_back to summary
protected void getMoreData_() throws SqlException

Implements abstract org.apache.derby.client.am.Cursor.getMoreData_.

getQryclsimpEnabledback to summary
pack-priv final boolean getQryclsimpEnabled()

Check whether QRYCLSIMP is enabled on this cursor.

Returns:boolean

true if QRYCLSIMP is enabled

initializeColumnInfoArraysback to summary
pack-priv void initializeColumnInfoArrays(Typdef typdef, int columnCount) throws DisconnectException
isNonTrivialDataLobback to summary
private boolean isNonTrivialDataLob(int index)
locatorback to summary
protected int locator(int column)

Implements abstract org.apache.derby.client.am.Cursor.locator.

Get locator for LOB of the designated column

Note that this method cannot be invoked on a LOB column that is NULL.

Parameters
column:int

column number, starts at 1

Returns:int

locator value, Lob.INVALID_LOCATOR if LOB value was sent instead of locator

nullDataForGCback to summary
public void nullDataForGC()

Overrides org.apache.derby.client.am.Cursor.nullDataForGC.

parseSQLCAGRPback to summary
private NetSqlca[] parseSQLCAGRP(Typdef typdef) throws DisconnectException, SqlException
parseSQLCARDback to summary
private NetSqlca[] parseSQLCARD(Typdef typdef) throws DisconnectException, SqlException
parseSQLCAXGRPback to summary
private void parseSQLCAXGRP(Typdef typdef, NetSqlca netSqlca) throws DisconnectException, SqlException
parseSQLDCGRPback to summary
private NetSqlca parseSQLDCGRP() throws DisconnectException, SqlException
parseSQLDCROWback to summary
private NetSqlca parseSQLDCROW() throws DisconnectException, SqlException
parseSQLDCTOKSback to summary
private void parseSQLDCTOKS() throws DisconnectException, SqlException
parseSQLDCXGRPback to summary
private void parseSQLDCXGRP() throws DisconnectException, SqlException
parseSQLDIAGCIback to summary
private NetSqlca[] parseSQLDIAGCI() throws DisconnectException, SqlException
parseSQLDIAGCNback to summary
private void parseSQLDIAGCN() throws DisconnectException, SqlException
parseSQLDIAGGRPback to summary
private NetSqlca[] parseSQLDIAGGRP() throws DisconnectException, SqlException
parseSQLDIAGSTTback to summary
private void parseSQLDIAGSTT() throws DisconnectException, SqlException
parseVCSback to summary
private String parseVCS(Typdef typdefInEffect) throws DisconnectException, SqlException
readFdocaBytesback to summary
private byte[] readFdocaBytes(int length) throws DisconnectException, SqlException
readFdocaIntback to summary
private int readFdocaInt() throws DisconnectException, SqlException
readFdocaOneByteback to summary
private int readFdocaOneByte() throws DisconnectException, SqlException
readFdocaOneByteback to summary
private int readFdocaOneByte(int index) throws DisconnectException, SqlException
readFdocaStringback to summary
private String readFdocaString(int length, Charset encoding) throws SqlException
readFdocaTwoByteLengthback to summary
private int readFdocaTwoByteLength() throws DisconnectException, SqlException
readFdocaTwoByteLengthback to summary
private int readFdocaTwoByteLength(int index) throws DisconnectException, SqlException
resetCurrentRowPositionback to summary
private void resetCurrentRowPosition()
scanDataBufferForEndOfDataback to summary
pack-priv 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.

setAllRowsReceivedFromServerback to summary
public final void setAllRowsReceivedFromServer(boolean b)

Overrides org.apache.derby.client.am.Cursor.setAllRowsReceivedFromServer.

Set the value of value of allRowsReceivedFromServer_.

Parameters
b:boolean

a boolean value indicating whether all rows are received from the server

setQryclsimpEnabledback to summary
pack-priv final void setQryclsimpEnabled(boolean flag)

Set a flag indicating whether QRYCLSIMP is enabled.

Parameters
flag:boolean

true if QRYCLSIMP is enabled

shiftPartialRowToBeginningback to summary
private void shiftPartialRowToBeginning()
skipFdocaBytesback to summary
private int skipFdocaBytes(int length) throws DisconnectException, SqlException
skipFdocaBytesback to summary
private int skipFdocaBytes(int length, int index) throws DisconnectException, SqlException