Class NoPutResultSetImpl

    • Field Detail

      • resultSetNumber

        public final int resultSetNumber
      • needsRowLocation

        private boolean needsRowLocation
      • needsRowLocationForDeferredCheckConstraints

        private boolean needsRowLocationForDeferredCheckConstraints
      • clonedExecRow

        protected ExecRow clonedExecRow
      • checkNullCols

        protected int[] checkNullCols
      • cncLen

        protected int cncLen
    • Constructor Detail

      • NoPutResultSetImpl

        NoPutResultSetImpl​(Activation activation,
                           int resultSetNumber,
                           double optimizerEstimatedRowCount,
                           double optimizerEstimatedCost)
        Constructor
        Parameters:
        activation - The activation
        resultSetNumber - The resultSetNumber
        optimizerEstimatedRowCount - The optimizer's estimated number of rows.
        optimizerEstimatedCost - The optimizer's estimated cost
    • Method Detail

      • getCursorName

        public java.lang.String getCursorName()
        Return my cursor name for JDBC. Can be null.
        Returns:
        A String with the name of the cursor, if any. Returns NULL if this is not a cursor statement.
      • close

        public void close()
                   throws StandardException
        Close needs to invalidate any dependent statements, if this is a cursor. Must be called by any subclasses that override close().
        Throws:
        StandardException - on error
      • setNeedsRowLocation

        public void setNeedsRowLocation​(boolean needsRowLocation)
        Description copied from interface: NoPutResultSet
        Set whether or not the NPRS need the row location when acting as a row source. (The target result set determines this.)
        See Also:
        NoPutResultSet.setNeedsRowLocation(boolean)
      • setHasDeferrableChecks

        public void setHasDeferrableChecks()
        Description copied from interface: NoPutResultSet
        Set that we are acting on behalf of an insert result set that has deferrable check constraints
      • getValidColumns

        public FormatableBitSet getValidColumns()
        Description copied from interface: RowSource
        getValidColumns describes the DataValueDescriptor[] returned by all calls to the getNextRowFromRowSource() call. If getValidColumns returns null, the number of columns is given by the DataValueDescriptor.length where DataValueDescriptor[] is returned by the preceeding getNextRowFromRowSource() call. Column N maps to DataValueDescriptor[N], where column numbers start at zero. If getValidColumns return a non null validColumns FormatableBitSet the number of columns is given by the number of bits set in validColumns. Column N is not in the partial row if validColumns.get(N) returns false. Column N is in the partial row if validColumns.get(N) returns true. If column N is in the partial row then it maps to DataValueDescriptor[M] where M is the count of calls to validColumns.get(i) that return true where i < N. If DataValueDescriptor.length is greater than the number of columns indicated by validColumns the extra entries are ignored.
        See Also:
        RowSource.getValidColumns()
      • getNextRowFromRowSource

        public DataValueDescriptor[] getNextRowFromRowSource()
                                                      throws StandardException
        Description copied from interface: RowSource
        Get the next row as an array of column objects. The column objects can be a JBMS Storable or any Serializable/Externalizable/Formattable/Streaming type.
        A return of null indicates that the complete set of rows has been read.

        A null column can be specified by leaving the object null, or indicated by returning a non-null getValidColumns. On streaming columns, it can be indicated by returning a non-null get FieldStates.

        If RowSource.needToClone() is true then the returned row (the DataValueDescriptor[]) is guaranteed not to be modified by drainer of the RowSource (except that the input stream will be read, of course) and drainer will keep no reference to it before making the subsequent nextRow call. So it is safe to return the same DataValueDescriptor[] in subsequent nextRow calls if that is desirable for performance reasons.

        If RowSource.needToClone() is false then the returned row (the DataValueDescriptor[]) may be be modified by drainer of the RowSource, and the drainer may keep a reference to it after making the subsequent nextRow call. In this case the client should severe all references to the row after returning it from getNextRowFromRowSource().

        Throws:
        StandardException - on error
        See Also:
        RowSource.getNextRowFromRowSource()
      • needsToClone

        public boolean needsToClone()
        Description copied from interface: RowSource
        Does the caller of getNextRowFromRowSource() need to clone the row in order to keep a reference to the row past the getNextRowFromRowSource() call which returned the row. This call must always return the same for all rows in a RowSource (ie. the caller will call this once per scan from a RowSource and assume the behavior is true for all rows in the RowSource).
        See Also:
        RowSource.needsToClone()
      • closeRowSource

        public void closeRowSource()
        Description copied from interface: RowSource
        closeRowSource tells the RowSource that it will no longer need to return any rows and it can release any resource it may have. Subsequent call to any method on the RowSource will result in undefined behavior. A closed rowSource can be closed again.
        See Also:
        RowSource.closeRowSource()
      • needsRowLocation

        public boolean needsRowLocation()
        Description copied from interface: RowLocationRetRowSource
        needsRowLocation returns true iff this the row source expects the drainer of the row source to call rowLocation after getting a row from getNextRowFromRowSource.
        Returns:
        true iff this row source expects some row location to be returned
        See Also:
        RowLocationRetRowSource.needsRowLocation()
      • needsRowLocationForDeferredCheckConstraints

        public boolean needsRowLocationForDeferredCheckConstraints()
      • rowLocation

        public void rowLocation​(RowLocation rl)
                         throws StandardException
        Description copied from interface: RowLocationRetRowSource
        rowLocation is a callback for the drainer of the row source to return the rowLocation of the current row, i.e, the row that is being returned by getNextRowFromRowSource. This interface is for the purpose of loading a base table with index. In that case, the indices can be built at the same time the base table is laid down once the row location of the base row is known. This is an example pseudo code on how this call is expected to be used:
                        boolean needsRL = rowSource.needsRowLocation();
                        DataValueDescriptor[] row;
                        while((row = rowSource.getNextRowFromRowSource()) != null)
                        {
                                RowLocation rl = heapConglomerate.insertRow(row);
                                if (needsRL)
                                        rowSource.rowLocation(rl);
                        }
                        

        NeedsRowLocation and rowLocation will ONLY be called by a drainer of the row source which CAN return a row location. Drainer of row source which cannot return rowLocation will guarantee to not call either callbacks. Conversely, if NeedsRowLocation is called and it returns true, then for every row return by getNextRowFromRowSource, a rowLocation callback must also be issued with the row location of the row. Implementor of both the source and the drain of the row source must be aware of this protocol.
        The RowLocation object is own by the caller of rowLocation, in other words, the drainer of the RowSource. This is so that we don't need to new a row location for every row. If the Row Source wants to keep the row location, it needs to clone it (RowLocation is a ClonableObject).
        Throws:
        StandardException - on error
        See Also:
        RowLocationRetRowSource.rowLocation(org.apache.derby.iapi.types.RowLocation)
      • clearOrderableCache

        protected void clearOrderableCache​(Qualifier[][] qualifiers)
                                    throws StandardException
        Clear the Orderable cache for each qualifier. (This should be done each time a scan/conglomerate with qualifiers is reopened.)
        Parameters:
        qualifiers - The Qualifiers to clear
        Throws:
        StandardException
      • setCurrentRow

        public final void setCurrentRow​(ExecRow row)
        Set the current row to the row passed in.
        Parameters:
        row - the new current row
      • clearCurrentRow

        public void clearCurrentRow()
        Clear the current row
      • isForUpdate

        public boolean isForUpdate()
        Is this ResultSet or it's source result set for update This method will be overriden in the inherited Classes if it is true
        Specified by:
        isForUpdate in interface NoPutResultSet
        Overrides:
        isForUpdate in class BasicNoPutResultSetImpl
        Returns:
        Whether or not the result set is for update.
      • skipScan

        protected boolean skipScan​(ExecIndexRow startPosition,
                                   ExecIndexRow stopPosition)
                            throws StandardException
        Return true if we should skip the scan due to nulls in the start or stop position when the predicate on the column(s) in question do not implement ordered null semantics. beetle 4464, we also compact the areNullsOrdered flags into checkNullCols here.
        Parameters:
        startPosition - An index row for the start position
        stopPosition - An index row for the stop position
        Returns:
        true means not to do the scan
        Throws:
        StandardException
      • skipRow

        protected boolean skipRow​(ExecRow row)
                           throws StandardException
        Return true if we should skip the scan due to nulls in the row when the start or stop positioners on the columns containing null do not implement ordered null semantics.
        Parameters:
        row - An index row
        Returns:
        true means skip the row because it has null
        Throws:
        StandardException
      • printQualifiers

        public static java.lang.String printQualifiers​(Qualifier[][] qualifiers)
        Return a 2-d array of Qualifiers as a String
      • unpackHashValue

        protected DataValueDescriptor[] unpackHashValue​(java.lang.Object hashValue)
        Get all of the columns out of a value stored in a BackingStoreHashtable.