Package org.apache.derby.client.am
Class Cursor
java.lang.Object
org.apache.derby.client.am.Cursor
- Direct Known Subclasses:
NetCursor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Agent
private boolean
static final int
int[]
private char[]
Charset[]
protected int[]
protected ArrayList
<boolean[]> protected ArrayList
<int[]> protected int[]
protected ArrayList
<int[]> int
protected int
byte[]
int[]
boolean
boolean[]
(package private) static final Charset
private boolean
(package private) boolean
int[]
int
(package private) int
private int
static final int
static final int
boolean[]
int
private Calendar
private static final Boolean
(package private) static final Boolean
(package private) long
static final int
(package private) static final Charset
(package private) static final Charset
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
final boolean
Returntrue
if all rows are received from the server.protected abstract boolean
calculateColumnOffsetsForRow_
(int row, boolean allowServerFetch) Calculate the column offsets for a row.protected abstract void
private ColumnTypeConversionException
coercionError
(String targetType, int sourceColumn) (package private) final boolean
(package private) final boolean
private final long
get_BIGINT
(int column) private boolean
get_BOOLEAN
(int column) private byte[]
get_CHAR_FOR_BIT_DATA
(int column) private final BigDecimal
get_DECIMAL
(int column) private final double
get_DOUBLE
(int column) private final float
get_FLOAT
(int column) protected final int
get_INTEGER
(int column) private final short
get_SMALLINT
(int column) private Object
get_UDT
(int column) private byte[]
get_VARCHAR_FOR_BIT_DATA
(int column) (package private) final Array
getArray
(int column) (package private) final InputStream
getAsciiStream
(int column) (package private) final BigDecimal
getBigDecimal
(int column) (package private) final InputStream
getBinaryStream
(int column) (package private) final Blob
getBlob
(int column) abstract ClientBlob
getBlobColumn_
(int column, Agent agent, boolean toBePublished) Returns aBlob
object.(package private) final boolean
getBoolean
(int column) (package private) final byte
getByte
(int column) (package private) final byte[]
getBytes
(int column) private String
getCHAR
(int column) (package private) final Reader
getCharacterStream
(int column) (package private) final Clob
getClob
(int column) abstract ClientClob
getClobColumn_
(int column, Agent agent, boolean toBePublished) Returns aClob
object.private int
getColumnPrecision
(int column) private int
getColumnScale
(int column) (package private) final Date
private Date
private final Date
getDateFromTIMESTAMP
(int column, Calendar cal) (package private) final double
getDouble
(int column) private double
getDoubleFromDECIMAL
(int column) (package private) final float
getFloat
(int column) (package private) final int
getInt
(int column) final boolean
Get updated status for this row.final boolean
Get deleted status for this row.(package private) CallableLocatorProcedures
Returns a reference to the locator procedures.(package private) final long
getLong
(int column) private long
getLongFromDECIMAL
(int column, String targetType) protected abstract void
(package private) final Object
getObject
(int column) private Calendar
Instantiate an instance of Calendar that can be re-used for getting Time, Timestamp, and Date values from this cursor.(package private) final Ref
getRef
(int column) (package private) final short
getShort
(int column) (package private) final String
getString
(int column) private String
getStringFromDATE
(int column) private String
getStringFromTIME
(int column) private String
getStringFromTIMESTAMP
(int column) private String
getStringWithoutConvert
(int position, int actualLength) (package private) final Time
private Time
private final Time
getTimeFromTIMESTAMP
(int column, Calendar cal) (package private) final Timestamp
getTimestamp
(int column, Calendar cal) private final Timestamp
getTIMESTAMP
(int column, Calendar cal) private final Timestamp
getTimestampFromDATE
(int column, Calendar cal) private final Timestamp
getTimestampFromTIME
(int column, Calendar cal) private String
getVARCHAR
(int column) final void
protected abstract int
locator
(int column) Returns the locator for the specified LOB column, orLob.INVALID_LOCATOR
if the LOB was not sent as a locator.protected final void
protected final void
boolean
next()
Makes the next row the current row.void
final void
void
setAllRowsReceivedFromServer
(boolean b) Set the value of value of allRowsReceivedFromServer_.final void
setIsRowUpdated
(boolean isRowUpdated) Keep track of updated status for this row.final void
setIsUpdataDeleteHole
(int row, boolean isRowNull) void
setNumberOfColumns
(int numberOfColumns) protected boolean
stepNext
(boolean allowServerFetch) Makes the next row the current row.
-
Field Details
-
agent_
-
STRING
public static final int STRING- See Also:
-
VARIABLE_STRING
public static final int VARIABLE_STRING- See Also:
-
VARIABLE_SHORT_STRING
public static final int VARIABLE_SHORT_STRING- See Also:
-
NULL_TERMINATED_STRING
public static final int NULL_TERMINATED_STRING- See Also:
-
BYTES
public static final int BYTES- See Also:
-
NULL_TERMINATED_BYTES
public static final int NULL_TERMINATED_BYTES- See Also:
-
UTF_16BE
-
UTF_8
-
ISO_8859_1
-
dataBuffer_
public byte[] dataBuffer_ -
dataBufferStream_
-
position_
public int position_ -
lastValidBytePosition_
public int lastValidBytePosition_ -
hasLobs_
public boolean hasLobs_ -
currentRowPosition_
protected int currentRowPosition_ -
nextRowPosition_
private int nextRowPosition_ -
columnDataPosition_
protected int[] columnDataPosition_ -
columnDataComputedLength_
protected int[] columnDataComputedLength_ -
allRowsReceivedFromServer_
private boolean allRowsReceivedFromServer_ -
rowsRead_
long rowsRead_ -
maxFieldSize_
int maxFieldSize_ -
columnDataPositionCache_
-
columnDataLengthCache_
-
columnDataIsNullCache_
-
isUpdateDeleteHoleCache_
-
isUpdateDeleteHole_
boolean isUpdateDeleteHole_ -
isRowUpdated_
private boolean isRowUpdated_ -
ROW_IS_NULL
-
ROW_IS_NOT_NULL
-
recyclableCalendar_
-
jdbcTypes_
public int[] jdbcTypes_ -
columns_
public int columns_ -
nullable_
public boolean[] nullable_ -
charset_
-
isNull_
public boolean[] isNull_ -
fdocaLength_
public int[] fdocaLength_ -
ccsid_
public int[] ccsid_ -
charBuffer_
private char[] charBuffer_
-
-
Constructor Details
-
Cursor
-
-
Method Details
-
setNumberOfColumns
public void setNumberOfColumns(int numberOfColumns) -
stepNext
Makes the next row the current row. Returns true if the current row position is a valid row position.- Parameters:
allowServerFetch
- if false, don't fetch more data from the server even if more data is needed- Returns:
true
if current row position is valid- Throws:
SqlException
- if an error occurs
-
next
Makes the next row the current row. Returns true if the current row position is a valid row position.- Returns:
true
if current row position is valid- Throws:
SqlException
- if an error occurs
-
setAllRowsReceivedFromServer
public void setAllRowsReceivedFromServer(boolean b) Set the value of value of allRowsReceivedFromServer_.- Parameters:
b
- aboolean
value indicating whether all rows are received from the server
-
allRowsReceivedFromServer
public final boolean allRowsReceivedFromServer()Returntrue
if all rows are received from the server.- Returns:
true
if all rows are received from the server.
-
currentRowPositionIsEqualToNextRowPosition
final boolean currentRowPositionIsEqualToNextRowPosition() -
resetDataBuffer
public final void resetDataBuffer() -
dataBufferHasUnprocessedData
final boolean dataBufferHasUnprocessedData() -
calculateColumnOffsetsForRow_
protected abstract boolean calculateColumnOffsetsForRow_(int row, boolean allowServerFetch) throws SqlException, DisconnectException Calculate the column offsets for a row.- Parameters:
row
- 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
-
clearLobData_
protected abstract void clearLobData_() -
getMoreData_
- Throws:
SqlException
-
setIsUpdataDeleteHole
public final void setIsUpdataDeleteHole(int row, boolean isRowNull) -
setIsRowUpdated
public final void setIsRowUpdated(boolean isRowUpdated) Keep track of updated status for this row.- Parameters:
isRowUpdated
- true if row has been updated- See Also:
-
getIsRowUpdated
public final boolean getIsRowUpdated()Get updated status for this row. Minion of ResultSet#rowUpdated.- See Also:
-
getIsUpdateDeleteHole
public final boolean getIsUpdateDeleteHole()Get deleted status for this row. Minion of ResultSet#rowDeleted.- See Also:
-
markNextRowPosition
protected final void markNextRowPosition() -
makeNextRowPositionCurrent
protected final void makeNextRowPositionCurrent() -
incrementRowsReadEvent
public final void incrementRowsReadEvent() -
get_BOOLEAN
private boolean get_BOOLEAN(int column) -
get_SMALLINT
private final short get_SMALLINT(int column) -
get_INTEGER
protected final int get_INTEGER(int column) -
get_BIGINT
private final long get_BIGINT(int column) -
get_FLOAT
private final float get_FLOAT(int column) -
get_DOUBLE
private final double get_DOUBLE(int column) -
get_DECIMAL
- Throws:
SqlException
-
getDoubleFromDECIMAL
- Throws:
SqlException
-
getLongFromDECIMAL
- Throws:
SqlException
-
getVARCHAR
- Throws:
SqlException
-
getCHAR
- Throws:
SqlException
-
getDATE
- Throws:
SqlException
-
getTIME
- Throws:
SqlException
-
getTIMESTAMP
- Throws:
SqlException
-
getTimestampFromDATE
- Throws:
SqlException
-
getTimestampFromTIME
- Throws:
SqlException
-
getDateFromTIMESTAMP
- Throws:
SqlException
-
getTimeFromTIMESTAMP
- Throws:
SqlException
-
getStringFromDATE
- Throws:
SqlException
-
getStringFromTIME
- Throws:
SqlException
-
getStringFromTIMESTAMP
- Throws:
SqlException
-
get_CHAR_FOR_BIT_DATA
- Throws:
SqlException
-
get_VARCHAR_FOR_BIT_DATA
- Throws:
SqlException
-
get_UDT
- Throws:
SqlException
-
getRecyclableCalendar
Instantiate an instance of Calendar that can be re-used for getting Time, Timestamp, and Date values from this cursor. Assumption is that all users of the returned Calendar object will clear it as appropriate before using it. -
getLocatorProcedures
CallableLocatorProcedures getLocatorProcedures()Returns a reference to the locator procedures.These procedures are used to operate on large objects referenced on the server by locators.
- Returns:
- The locator procedures object.
-
locator
protected abstract int locator(int column) Returns the locator for the specified LOB column, orLob.INVALID_LOCATOR
if the LOB was not sent as a locator. The server may send the LOB value instead of a locator if it is running an old version which doesn't support locators, or if the database it accesses is soft upgraded from a version that doesn't have the necessary stored procedures for locator support.Note that this method cannot be invoked on a LOB column that is NULL.
- Parameters:
column
- 1-based column index- Returns:
- A positive integer locator if valid,
Lob.INVALID_LOCATOR
otherwise.
-
getBlobColumn_
public abstract ClientBlob getBlobColumn_(int column, Agent agent, boolean toBePublished) throws SqlException Returns aBlob
object.- 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
-
getClobColumn_
public abstract ClientClob getClobColumn_(int column, Agent agent, boolean toBePublished) throws SqlException Returns aClob
object.- 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
-
getBoolean
- Throws:
SqlException
-
getByte
- Throws:
SqlException
-
getShort
- Throws:
SqlException
-
getInt
- Throws:
SqlException
-
getLong
- Throws:
SqlException
-
getFloat
- Throws:
SqlException
-
getDouble
- Throws:
SqlException
-
getBigDecimal
- Throws:
SqlException
-
getDate
- Throws:
SqlException
-
getTime
- Throws:
SqlException
-
getTimestamp
- Throws:
SqlException
-
getString
- Throws:
SqlException
-
getBytes
- Throws:
SqlException
-
getBinaryStream
- Throws:
SqlException
-
getAsciiStream
- Throws:
SqlException
-
getCharacterStream
- Throws:
SqlException
-
getBlob
- Throws:
SqlException
-
getClob
- Throws:
SqlException
-
getArray
- Throws:
SqlException
-
getRef
- Throws:
SqlException
-
getObject
- Throws:
SqlException
-
allocateCharBuffer
public final void allocateCharBuffer() -
getStringWithoutConvert
-
coercionError
-
nullDataForGC
public void nullDataForGC() -
getColumnPrecision
private int getColumnPrecision(int column) -
getColumnScale
private int getColumnScale(int column)
-