Class Cursor

  • Direct Known Subclasses:
    NetCursor

    public abstract class Cursor
    extends java.lang.Object
    • Field Detail

      • agent_

        protected Agent agent_
      • UTF_16BE

        static final java.nio.charset.Charset UTF_16BE
      • UTF_8

        static final java.nio.charset.Charset UTF_8
      • ISO_8859_1

        static final java.nio.charset.Charset ISO_8859_1
      • dataBuffer_

        public byte[] dataBuffer_
      • dataBufferStream_

        public java.io.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 java.util.ArrayList<int[]> columnDataPositionCache_
      • columnDataLengthCache_

        protected java.util.ArrayList<int[]> columnDataLengthCache_
      • columnDataIsNullCache_

        protected java.util.ArrayList<boolean[]> columnDataIsNullCache_
      • isUpdateDeleteHoleCache_

        java.util.ArrayList<java.lang.Boolean> isUpdateDeleteHoleCache_
      • isUpdateDeleteHole_

        boolean isUpdateDeleteHole_
      • isRowUpdated_

        private boolean isRowUpdated_
      • ROW_IS_NULL

        static final java.lang.Boolean ROW_IS_NULL
      • ROW_IS_NOT_NULL

        private static final java.lang.Boolean ROW_IS_NOT_NULL
      • recyclableCalendar_

        private java.util.Calendar recyclableCalendar_
      • jdbcTypes_

        public int[] jdbcTypes_
      • columns_

        public int columns_
      • nullable_

        public boolean[] nullable_
      • charset_

        public java.nio.charset.Charset[] charset_
      • isNull_

        public boolean[] isNull_
      • fdocaLength_

        public int[] fdocaLength_
      • ccsid_

        public int[] ccsid_
      • charBuffer_

        private char[] charBuffer_
    • Constructor Detail

      • Cursor

        public Cursor​(Agent agent)
    • Method Detail

      • 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_()
      • 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()
      • getIsRowUpdated

        public final boolean getIsRowUpdated()
        Get updated status for this row. Minion of ResultSet#rowUpdated.
        See Also:
        setIsRowUpdated(boolean)
      • getIsUpdateDeleteHole

        public final boolean getIsUpdateDeleteHole()
        Get deleted status for this row. Minion of ResultSet#rowDeleted.
        See Also:
        setIsUpdataDeleteHole(int, boolean)
      • 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)
      • getLongFromDECIMAL

        private long getLongFromDECIMAL​(int column,
                                        java.lang.String targetType)
                                 throws SqlException
        Throws:
        SqlException
      • getDATE

        private java.sql.Date getDATE​(int column,
                                      java.util.Calendar cal)
                               throws SqlException
        Throws:
        SqlException
      • getTIME

        private java.sql.Time getTIME​(int column,
                                      java.util.Calendar cal)
                               throws SqlException
        Throws:
        SqlException
      • getTIMESTAMP

        private final java.sql.Timestamp getTIMESTAMP​(int column,
                                                      java.util.Calendar cal)
                                               throws SqlException
        Throws:
        SqlException
      • getTimestampFromDATE

        private final java.sql.Timestamp getTimestampFromDATE​(int column,
                                                              java.util.Calendar cal)
                                                       throws SqlException
        Throws:
        SqlException
      • getTimestampFromTIME

        private final java.sql.Timestamp getTimestampFromTIME​(int column,
                                                              java.util.Calendar cal)
                                                       throws SqlException
        Throws:
        SqlException
      • getDateFromTIMESTAMP

        private final java.sql.Date getDateFromTIMESTAMP​(int column,
                                                         java.util.Calendar cal)
                                                  throws SqlException
        Throws:
        SqlException
      • getTimeFromTIMESTAMP

        private final java.sql.Time getTimeFromTIMESTAMP​(int column,
                                                         java.util.Calendar cal)
                                                  throws SqlException
        Throws:
        SqlException
      • getStringFromDATE

        private java.lang.String getStringFromDATE​(int column)
                                            throws SqlException
        Throws:
        SqlException
      • getStringFromTIME

        private java.lang.String getStringFromTIME​(int column)
                                            throws SqlException
        Throws:
        SqlException
      • getStringFromTIMESTAMP

        private java.lang.String getStringFromTIMESTAMP​(int column)
                                                 throws SqlException
        Throws:
        SqlException
      • get_VARCHAR_FOR_BIT_DATA

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

        private java.util.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
      • getDate

        final java.sql.Date getDate​(int column,
                                    java.util.Calendar cal)
                             throws SqlException
        Throws:
        SqlException
      • getTime

        final java.sql.Time getTime​(int column,
                                    java.util.Calendar cal)
                             throws SqlException
        Throws:
        SqlException
      • getTimestamp

        final java.sql.Timestamp getTimestamp​(int column,
                                              java.util.Calendar cal)
                                       throws SqlException
        Throws:
        SqlException
      • allocateCharBuffer

        public final void allocateCharBuffer()
      • getStringWithoutConvert

        private java.lang.String getStringWithoutConvert​(int position,
                                                         int actualLength)
      • nullDataForGC

        public void nullDataForGC()
      • getColumnPrecision

        private int getColumnPrecision​(int column)
      • getColumnScale

        private int getColumnScale​(int column)