Class ScanResultSet

  • All Implemented Interfaces:
    NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource
    Direct Known Subclasses:
    DependentResultSet, HashScanResultSet, LastIndexKeyResultSet, TableScanResultSet

    abstract class ScanResultSet
    extends NoPutResultSetImpl
    Abstract ResultSet class for NoPutResultSets which contain a scan. Returns rows that may be a column sub-set of the rows in the underlying object to be scanned. If accessedCols is not null then a sub-set of columns will be fetched from the underlying object (usually into the candidate row object), then the returned rows will be a compacted form of that row, with the not-fetched columns moved out. If accessedCols is null then the full row will be returned.
    Example: if accessedCols indicates that we want to retrieve columns 1 and 4, then candidate row will have space for 5 columns (because that's the size of the rows in the underlying object), but only cols "1" and "4" will have values:
         0    1    2    3    4
      [  - , COL1,  - ,  - , COL4 ]
      

    Rows returned by this ScanResultSet will have the values:
         0     1
      [ COL1, COL4 ]
     
    • Field Detail

      • tableLocked

        private final boolean tableLocked
        If true, the table is marked as table locked in SYS.SYSTABLES.
      • unspecifiedIsolationLevel

        private final boolean unspecifiedIsolationLevel
        If true, the isolation level is unspecified and must be refreshed on each open.
      • suppliedLockMode

        private final int suppliedLockMode
        The lock mode supplied through the constructor.
      • isolationLevelNeedsUpdate

        private boolean isolationLevelNeedsUpdate
        Tells whether the isolation level needs to be updated.
      • lockMode

        int lockMode
        The actual lock mode used.
      • isolationLevel

        int isolationLevel
        The scan isolation level.
      • resultRowBuilder

        final ExecRowBuilder resultRowBuilder
        Object used to create and reset the candidate row.
      • candidate

        final ExecRow candidate
        The candidate row, matches the shape of the rows in the underlying object to be scanned.
      • accessedCols

        protected FormatableBitSet accessedCols
        If not null indicates the subset of columns that need to be pulled from the underlying object to be scanned. Set from the PreparedStatement's saved objects, if it exists.
      • fetchRowLocations

        protected boolean fetchRowLocations
        true if the scan should pick up row locations
      • tableName

        public java.lang.String tableName
      • indexName

        public java.lang.String indexName
    • Constructor Detail

      • ScanResultSet

        ScanResultSet​(Activation activation,
                      int resultSetNumber,
                      int resultRowTemplate,
                      int lockMode,
                      boolean tableLocked,
                      int isolationLevel,
                      int colRefItem,
                      double optimizerEstimatedRowCount,
                      double optimizerEstimatedCost)
               throws StandardException
        Construct a ScanResultSet.
        Parameters:
        activation - the activation
        resultSetNumber - number of the result set (unique within statement)
        resultRowTemplate - identifier of saved object for row template
        lockMode - lock mode (record or table)
        tableLocked - true if marked as table locked in SYS.SYSTABLES
        isolationLevel - language isolation level for the result set
        colRefItem - Identifier of saved object for accessedCols, -1 if need to fetch all columns.
        optimizerEstimatedRowCount - estimated row count
        optimizerEstimatedCost - estimated cost
        Throws:
        StandardException
    • Method Detail

      • initIsolationLevel

        void initIsolationLevel()
        Initialize the isolation level and the lock mode. If the result set was constructed with an explicit isolation level, or if the isolation level has already been initialized, this is a no-op. All sub-classes should invoke this method from their openCore() methods.
      • getLockMode

        private int getLockMode​(int languageLevel)
        Get the lock mode based on the language isolation level. Always do row locking unless the isolation level is serializable or the table is marked as table locked.
        Parameters:
        languageLevel - the (language) isolation level
        Returns:
        lock mode
      • translateLanguageIsolationLevel

        private int translateLanguageIsolationLevel​(int languageLevel)
        Translate isolation level from language to store.
        Parameters:
        languageLevel - language isolation level
        Returns:
        store isolation level
      • canGetInstantaneousLocks

        abstract boolean canGetInstantaneousLocks()
        Can we get instantaneous locks when getting share row locks at READ COMMITTED.
      • toXML

        public org.w3c.dom.Element toXML​(org.w3c.dom.Element parentNode,
                                         java.lang.String tag)
                                  throws java.lang.Exception
        Description copied from interface: ResultSet

        Produce an xml image of this ResultSet and its descendant ResultSets. Appends an element to the parentNode and returns the appended element.

        Specified by:
        toXML in interface ResultSet
        Overrides:
        toXML in class BasicNoPutResultSetImpl
        Parameters:
        parentNode - Node to put content into.
        tag - Element tag for content
        Returns:
        the content as an element with the given tag name
        Throws:
        java.lang.Exception