Class Cursor

java.lang.Object
org.apache.derby.client.am.Cursor
Direct Known Subclasses:
NetCursor

public abstract class Cursor extends Object
  • Field Details

    • agent_

      protected Agent 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

      static final Charset UTF_16BE
    • UTF_8

      static final Charset UTF_8
    • ISO_8859_1

      static final Charset ISO_8859_1
    • dataBuffer_

      public byte[] dataBuffer_
    • dataBufferStream_

      public ByteArrayOutputStream 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_

      protected ArrayList<int[]> columnDataPositionCache_
    • columnDataLengthCache_

      protected ArrayList<int[]> columnDataLengthCache_
    • columnDataIsNullCache_

      protected ArrayList<boolean[]> columnDataIsNullCache_
    • isUpdateDeleteHoleCache_

      ArrayList<Boolean> isUpdateDeleteHoleCache_
    • isUpdateDeleteHole_

      boolean isUpdateDeleteHole_
    • isRowUpdated_

      private boolean isRowUpdated_
    • ROW_IS_NULL

      static final Boolean ROW_IS_NULL
    • ROW_IS_NOT_NULL

      private static final Boolean ROW_IS_NOT_NULL
    • recyclableCalendar_

      private Calendar recyclableCalendar_
    • jdbcTypes_

      public int[] jdbcTypes_
    • columns_

      public int columns_
    • nullable_

      public boolean[] nullable_
    • charset_

      public Charset[] charset_
    • isNull_

      public boolean[] isNull_
    • fdocaLength_

      public int[] fdocaLength_
    • ccsid_

      public int[] ccsid_
    • charBuffer_

      private char[] charBuffer_
  • Constructor Details

    • Cursor

      public Cursor(Agent agent)
  • Method Details

    • setNumberOfColumns

      public void setNumberOfColumns(int numberOfColumns)
    • stepNext

      protected boolean stepNext(boolean allowServerFetch) throws SqlException
      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

      public boolean next() throws SqlException
      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 - a boolean value indicating whether all rows are received from the server
    • allRowsReceivedFromServer

      public final boolean allRowsReceivedFromServer()
      Return true 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 index
      allowServerFetch - 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_

      protected abstract void getMoreData_() throws SqlException
      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

      private final BigDecimal get_DECIMAL(int column) throws SqlException
      Throws:
      SqlException
    • getDoubleFromDECIMAL

      private double getDoubleFromDECIMAL(int column) throws SqlException
      Throws:
      SqlException
    • getLongFromDECIMAL

      private long getLongFromDECIMAL(int column, String targetType) throws SqlException
      Throws:
      SqlException
    • getVARCHAR

      private String getVARCHAR(int column) throws SqlException
      Throws:
      SqlException
    • getCHAR

      private String getCHAR(int column) throws SqlException
      Throws:
      SqlException
    • getDATE

      private Date getDATE(int column, Calendar cal) throws SqlException
      Throws:
      SqlException
    • getTIME

      private Time getTIME(int column, Calendar cal) throws SqlException
      Throws:
      SqlException
    • getTIMESTAMP

      private final Timestamp getTIMESTAMP(int column, Calendar cal) throws SqlException
      Throws:
      SqlException
    • getTimestampFromDATE

      private final Timestamp getTimestampFromDATE(int column, Calendar cal) throws SqlException
      Throws:
      SqlException
    • getTimestampFromTIME

      private final Timestamp getTimestampFromTIME(int column, Calendar cal) throws SqlException
      Throws:
      SqlException
    • getDateFromTIMESTAMP

      private final Date getDateFromTIMESTAMP(int column, Calendar cal) throws SqlException
      Throws:
      SqlException
    • getTimeFromTIMESTAMP

      private final Time getTimeFromTIMESTAMP(int column, Calendar cal) throws SqlException
      Throws:
      SqlException
    • getStringFromDATE

      private String getStringFromDATE(int column) throws SqlException
      Throws:
      SqlException
    • getStringFromTIME

      private String getStringFromTIME(int column) throws SqlException
      Throws:
      SqlException
    • getStringFromTIMESTAMP

      private String getStringFromTIMESTAMP(int column) throws SqlException
      Throws:
      SqlException
    • get_CHAR_FOR_BIT_DATA

      private byte[] get_CHAR_FOR_BIT_DATA(int column) throws SqlException
      Throws:
      SqlException
    • get_VARCHAR_FOR_BIT_DATA

      private byte[] get_VARCHAR_FOR_BIT_DATA(int column) throws SqlException
      Throws:
      SqlException
    • get_UDT

      private Object get_UDT(int column) throws SqlException
      Throws:
      SqlException
    • getRecyclableCalendar

      private Calendar 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, or Lob.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 a Blob object.
      Parameters:
      column - 1-based column index
      agent - associated agent
      toBePublished - whether the Blob will be published to the user
      Returns:
      A Blob object.
      Throws:
      SqlException - if getting the Blob fails
    • getClobColumn_

      public abstract ClientClob getClobColumn_(int column, Agent agent, boolean toBePublished) throws SqlException
      Returns a Clob object.
      Parameters:
      column - 1-based column index
      agent - associated agent
      toBePublished - whether the Clob will be published to the user
      Returns:
      A java.sql.Clob object.
      Throws:
      SqlException - if getting the Clob fails
    • getBoolean

      final boolean getBoolean(int column) throws SqlException
      Throws:
      SqlException
    • getByte

      final byte getByte(int column) throws SqlException
      Throws:
      SqlException
    • getShort

      final short getShort(int column) throws SqlException
      Throws:
      SqlException
    • getInt

      final int getInt(int column) throws SqlException
      Throws:
      SqlException
    • getLong

      final long getLong(int column) throws SqlException
      Throws:
      SqlException
    • getFloat

      final float getFloat(int column) throws SqlException
      Throws:
      SqlException
    • getDouble

      final double getDouble(int column) throws SqlException
      Throws:
      SqlException
    • getBigDecimal

      final BigDecimal getBigDecimal(int column) throws SqlException
      Throws:
      SqlException
    • getDate

      final Date getDate(int column, Calendar cal) throws SqlException
      Throws:
      SqlException
    • getTime

      final Time getTime(int column, Calendar cal) throws SqlException
      Throws:
      SqlException
    • getTimestamp

      final Timestamp getTimestamp(int column, Calendar cal) throws SqlException
      Throws:
      SqlException
    • getString

      final String getString(int column) throws SqlException
      Throws:
      SqlException
    • getBytes

      final byte[] getBytes(int column) throws SqlException
      Throws:
      SqlException
    • getBinaryStream

      final InputStream getBinaryStream(int column) throws SqlException
      Throws:
      SqlException
    • getAsciiStream

      final InputStream getAsciiStream(int column) throws SqlException
      Throws:
      SqlException
    • getCharacterStream

      final Reader getCharacterStream(int column) throws SqlException
      Throws:
      SqlException
    • getBlob

      final Blob getBlob(int column) throws SqlException
      Throws:
      SqlException
    • getClob

      final Clob getClob(int column) throws SqlException
      Throws:
      SqlException
    • getArray

      final Array getArray(int column) throws SqlException
      Throws:
      SqlException
    • getRef

      final Ref getRef(int column) throws SqlException
      Throws:
      SqlException
    • getObject

      final Object getObject(int column) throws SqlException
      Throws:
      SqlException
    • allocateCharBuffer

      public final void allocateCharBuffer()
    • getStringWithoutConvert

      private String getStringWithoutConvert(int position, int actualLength)
    • coercionError

      private ColumnTypeConversionException coercionError(String targetType, int sourceColumn)
    • nullDataForGC

      public void nullDataForGC()
    • getColumnPrecision

      private int getColumnPrecision(int column)
    • getColumnScale

      private int getColumnScale(int column)