Documentation of 'org.apache.derby.impl.sql.execute.BaseActivation' Java class
BaseActivation
org.apache.derby.impl.sql.execute

Class BaseActivation

    • Method Detail

      • execute

        public final ResultSet execute()
                                throws StandardException
        Description copied from interface: Activation
        When the prepared statement is executed, it passes execution on to the activation execution was requested for.
        Specified by:
        execute in interface Activation
        Returns:
        the ResultSet for further manipulation, if any.
        Throws:
        StandardException - Thrown on failure
      • popConstantAction

        public ConstantAction popConstantAction()
        Description copied from interface: Activation
        Pop the ConstantAction stack, returning the element which was just popped off the stack.
        Specified by:
        popConstantAction in interface Activation
      • setupActivation

        public final void setupActivation(ExecPreparedStatement ps,
                                          boolean scrollable)
                                   throws StandardException
        Link this activation with its PreparedStatement. It can be called with null to break the link with the PreparedStatement.
        Parameters:
        ps - prepared statement
        scrollable - activation for a scrollable result set
        Throws:
        StandardException - standard error policy
      • getResultSet

        public ResultSet getResultSet()
        Description copied from interface: Activation
        Returns the current result set for this activation, i.e. the one returned by the last execute() call. If there has been no execute call or the activation has been reset or closed, a null is returned.
        Specified by:
        getResultSet in interface Activation
        Returns:
        the current ResultSet of this activation.
      • getRowLocationTemplate

        public RowLocation getRowLocationTemplate(int itemNumber)
        Get the saved RowLocation.
        Specified by:
        getRowLocationTemplate in interface Activation
        Parameters:
        itemNumber - The saved item number.
        Returns:
        A RowLocation template for the conglomerate
      • getResultDescription

        public ResultDescription getResultDescription()
        Description copied from interface: Activation
        Get the result description for this activation, if it has one.
        Specified by:
        getResultDescription in interface Activation
        Returns:
        result description for this activation, if it has one; otherwise, null.
      • reset

        public void reset()
                   throws StandardException
        This is a partial implementation of reset. Subclasses will want to reset information they are aware of, such as parameters.

        All subclasses must call super.reset() and then do their cleanup.

        The execute call must set the resultSet field to be the resultSet that it has returned.

        Specified by:
        reset in interface Activation
        Throws:
        StandardException - on error
      • close

        public final void close()
                         throws StandardException
        Closing an activation marks it as unusable. Any other requests made on it will fail. An activation should be marked closed when it is expected to not be used any longer, i.e. when the connection for it is closed, or it has suffered some sort of severe error. This should also remove it from the language connection context.
        Specified by:
        close in interface Activation
        Throws:
        StandardException - on error
      • isClosed

        public boolean isClosed()
        Find out if the activation closed or not.
        Specified by:
        isClosed in interface Activation
        Returns:
        true if the prepared statement has been closed.
      • getNumSubqueries

        public int getNumSubqueries()
        Get the number of subqueries in the entire query.
        Specified by:
        getNumSubqueries in interface Activation
        Returns:
        int The number of subqueries in the entire query.
      • checkIfThisActivationHasHoldCursor

        public boolean checkIfThisActivationHasHoldCursor(java.lang.String tableName)
        Temporary tables can be declared with ON COMMIT DELETE ROWS. But if the table has a held curosr open at commit time, data should not be deleted from the table. This method, (gets called at commit time) checks if this activation held cursor and if so, does that cursor reference the passed temp table name.
        Specified by:
        checkIfThisActivationHasHoldCursor in interface Activation
        Returns:
        true if this activation has held cursor and if it references the passed temp table name
      • setCursorName

        public void setCursorName(java.lang.String cursorName)
        remember the cursor name
        Specified by:
        setCursorName in interface Activation
        Parameters:
        cursorName - The cursor name to use.
      • getCursorName

        public java.lang.String getCursorName()
        get the cursor name. For something that isn't a cursor, this is used as a string name of the result set for messages from things like the dependency manager.

        Activations that do support cursors will override this.

        Specified by:
        getCursorName in interface Activation
        Returns:
        The cursor name.
      • setResultSetHoldability

        public void setResultSetHoldability(boolean resultSetHoldability)
        Description copied from interface: Activation
        Set current resultset holdability.
        Specified by:
        setResultSetHoldability in interface Activation
        Parameters:
        resultSetHoldability - The new resultset holdability.
      • getResultSetHoldability

        public boolean getResultSetHoldability()
        Description copied from interface: Activation
        Return the holdability of this activation.

        Specified by:
        getResultSetHoldability in interface Activation
        Returns:
        The holdability of this activation.
      • setAutoGeneratedKeysResultsetInfo

        public void setAutoGeneratedKeysResultsetInfo(int[] columnIndexes,
                                                      java.lang.String[] columnNames)
        Description copied from interface: Activation
        Set the auto-generated keys resultset mode to true for this activation. The specific columns for auto-generated keys resultset can be requested by passing column positions array The specific columns for auto-generated keys resultset can be requested by passing column names array Both the parameters would be null if user didn't request specific keys. Otherwise, the user could request specific columns by passing column positions or names array but not both.
        Specified by:
        setAutoGeneratedKeysResultsetInfo in interface Activation
        Parameters:
        columnIndexes - Request specific columns in auto-generated keys resultset by passing column positions. null means no specific columns requested by position
        columnNames - Request specific columns in auto-generated keys resultset by passing column names. null means no specific columns requested by position
        See Also:
        Activation.setAutoGeneratedKeysResultsetInfo(int[], java.lang.String[])
      • getAutoGeneratedKeysColumnNames

        public java.lang.String[] getAutoGeneratedKeysColumnNames()
        Description copied from interface: Activation
        Returns the column names array of columns requested in auto-generated keys resultset for this avtivation. Returns null if no specific column requested by names

        Specified by:
        getAutoGeneratedKeysColumnNames in interface Activation
        Returns:
        column names array of columns requested.
        See Also:
        Activation.getAutoGeneratedKeysColumnNames()
      • getResultSetFactory

        public final ResultSetFactory getResultSetFactory()
        Used in the execute method of activations for generating the result sets that they concatenate together.
      • getTargetResultSet

        public CursorResultSet getTargetResultSet()
        Used in CurrentOfResultSet to get to the target result set for a cursor. Overridden by activations generated for updatable cursors. Those activations capture the target result set in a field in their execute() method, and then return the value of that field in their version of this method.
        Specified by:
        getTargetResultSet in interface CursorActivation
        Returns:
        null.
      • getCurrentValueAndAdvance

        public NumberDataValue getCurrentValueAndAdvance(java.lang.String sequenceUUIDstring,
                                                         int typeFormatID)
                                                  throws StandardException
        Called by generated code to get the next number in an ANSI/ISO sequence and advance the sequence. Raises an exception if the sequence was declared NO CYCLE and its range is exhausted.
        Specified by:
        getCurrentValueAndAdvance in interface Activation
        Parameters:
        sequenceUUIDstring - The string value of the sequence's UUID
        typeFormatID - The format id of the data type to be returned. E.g., StoredFormatIds.SQL_INTEGER_ID.
        Returns:
        The next number in the sequence
        Throws:
        StandardException
      • getCursorResultSet

        public CursorResultSet getCursorResultSet()
        Used in CurrentOfResultSet to get to the cursor result set for a cursor. Overridden by activations generated for updatable cursors. Those activations capture the cursor result set in a field in their execute() method, and then return the value of that field in their version of this method.
        Specified by:
        getCursorResultSet in interface CursorActivation
        Returns:
        null
      • throwIfClosed

        public void throwIfClosed(java.lang.String op)
                           throws StandardException
        Various activation methods need to disallow their invocation if the activation is closed. This lets them check and throw without generating alot of code.

        The code to write to generate the call to this is approximately: // jf is a JavaFactory CallableExpression ce = jf.newMethodCall( jf.thisExpression(), BaseActivation.CLASS_NAME, "throwIfClosed", "void", acb.exprArray(jf.newStringLiteral(...some literal here...))); //mb is a MethodBuilder mb.addStatement(jf.newStatement(ce)); The java code to write to call this is: this.throwIfClosed(...some literal here...); In both cases, "...some literal here..." gets replaced with an expression of type String that evaluates to the name of the operation that is being checked, like "execute" or "reset".

        Throws:
        StandardException - thrown if closed
      • setColumnPosition

        public static void setColumnPosition(int[] columnPositions,
                                             int positionToSet,
                                             int column)
        Set a column position in an array of column positions.
        Parameters:
        columnPositions - The array of column positions
        positionToSet - The place to put the column position
        column - The column position
      • allocateQualArray

        public static void allocateQualArray(Qualifier[][] qualifiers,
                                             int position,
                                             int length)
        Allocate an array of qualifiers and initialize in Qualifier[][]
        Parameters:
        qualifiers - The array of Qualifier arrays.
        position - The position in the array to set
        length - The array length of the qualifier array to allocate.
      • setQualifier

        public static void setQualifier(Qualifier[][] qualifiers,
                                        Qualifier qualifier,
                                        int position_1,
                                        int position_2)
        Set a Qualifier in a 2 dimensional array of Qualifiers. Set a single Qualifier into one slot of a 2 dimensional array of Qualifiers. @see Qualifier for detailed description of layout of the 2-d array.
        Parameters:
        qualifiers - The array of Qualifiers
        qualifier - The Qualifier
        position_1 - The Nth array index into qualifiers[N][M]
        position_2 - The Nth array index into qualifiers[N][M]
      • reinitializeQualifiers

        public static void reinitializeQualifiers(Qualifier[][] qualifiers)
        Reinitialize all Qualifiers in an array of Qualifiers.
        Parameters:
        qualifiers - The array of Qualifiers
      • markUnused

        public final void markUnused()
        Mark the activation as unused.
        Specified by:
        markUnused in interface Activation
      • isInUse

        public final boolean isInUse()
        Is the activation in use?
        Specified by:
        isInUse in interface Activation
        Returns:
        true/false
      • informOfRowCount

        public void informOfRowCount(NoPutResultSet resultSet,
                                     long currentRowCount)
                              throws StandardException
        Description copied from interface: Activation
        Tell this activation that the given ResultSet was found to have the given number of rows. This is used during execution to determine whether a table has grown or shrunk. If a table's size changes significantly, the activation may invalidate its PreparedStatement to force recompilation. Note that the association of row counts with ResultSets is kept in the activation class, not in the activation itself. This means that this method must be synchronized. This method is not required to check the number of rows on each call. Because of synchronization, this check is likely to be expensive, so it may only check every hundred calls or so.
        Specified by:
        informOfRowCount in interface Activation
        Throws:
        StandardException - Thrown on error
        See Also:
        Activation.informOfRowCount(org.apache.derby.iapi.sql.execute.NoPutResultSet, long)
      • getIndexConglomerateNumber

        public long getIndexConglomerateNumber()
        Description copied from interface: Activation
        Get the conglomerate number of the index, if any, that has already been opened for scaning for an update or delete. (Saves opening the ScanController twice.)
        Specified by:
        getIndexConglomerateNumber in interface Activation
        Returns:
        The conglomerate number, if available, to use for the update.
        See Also:
        Activation.getIndexConglomerateNumber()
      • setIndexConglomerateNumber

        public void setIndexConglomerateNumber(long indexConglomerateNumber)
        Description copied from interface: Activation
        Set the conglomerate number of the index to be used for an update or delete, when scanning an index that will also be updated (Saves opening the ScanController twice.)
        Specified by:
        setIndexConglomerateNumber in interface Activation
        Parameters:
        indexConglomerateNumber - The conglomerate number of the index to reuse for the update or delete.
        See Also:
        Activation.setIndexConglomerateNumber(long)
      • setForCreateTable

        public void setForCreateTable()
        Description copied from interface: Activation
        Mark the Activation as being for create table. (NOTE: We can do certain optimizations for create table that we can't do for other DDL.)
        Specified by:
        setForCreateTable in interface Activation
        See Also:
        Activation.setForCreateTable()
      • getForCreateTable

        public boolean getForCreateTable()
        Description copied from interface: Activation
        Get whether or not this activation is for create table. (NOTE: We can do certain optimizations for create table that we can't do for other DDL.)
        Specified by:
        getForCreateTable in interface Activation
        Returns:
        Whether or not this activation is for create table.
        See Also:
        Activation.getForCreateTable()
      • setMaxRows

        public void setMaxRows(long maxRows)
        Description copied from interface: Activation
        Set the maximum # of rows. (# of rows that can be returned by a ResultSet. 0 means no limit.)
        Specified by:
        setMaxRows in interface Activation
        Parameters:
        maxRows - Maximum # of rows. (0 means no limit.)
        See Also:
        Activation.setMaxRows(long)
      • getMaxRows

        public long getMaxRows()
        Description copied from interface: Activation
        Get the maximum # of rows. (# of rows that can be returned by a ResultSet. 0 means no limit.)
        Specified by:
        getMaxRows in interface Activation
        Returns:
        Maximum # of rows. (0 means no limit.)
        See Also:
        Activation.getMaxRows()
      • setTargetVTI

        public void setTargetVTI(java.sql.ResultSet targetVTI)
        Description copied from interface: Activation
        Save the ResultSet for the target of an update/delete to a VTI.
        Specified by:
        setTargetVTI in interface Activation
      • getTargetVTI

        public java.sql.ResultSet getTargetVTI()
        Description copied from interface: Activation
        Get the ResultSet for the target of an update/delete to a VTI.
        Specified by:
        getTargetVTI in interface Activation
        Returns:
        The ResultSet for the target of an update/delete to a VTI.
      • getScrollable

        public final boolean getScrollable()
      • getParameterValueSet

        public ParameterValueSet getParameterValueSet()
        return the parameters.
        Specified by:
        getParameterValueSet in interface Activation
        Returns:
        The ParameterValueSet for this execution of the statement. Returns NULL if there are no parameters.
      • setParameters

        public void setParameters(ParameterValueSet parameterValues,
                                  DataTypeDescriptor[] parameterTypes)
                           throws StandardException
        Description copied from interface: Activation
        Sets the parameter values for this execution of the statement.

        Has no effect if the activation has been closed.

        NOTE: The setParameters() method is currently unimplemented. A statement with parameters will generate its own ParameterValueSet, which can be gotten with the getParameterValueSet() method (above). The idea behind setParameters() is to improve performance when operating across a network by allowing all the parameters to be set in one call, as opposed to one call per parameter.

        Specified by:
        setParameters in interface Activation
        Parameters:
        parameterValues - The values of the parameters.
        Throws:
        StandardException
      • throwIfMissingParms

        public void throwIfMissingParms()
                                 throws StandardException
        Throw an exception if any parameters are uninitialized.
        Throws:
        StandardException - Thrown if any parameters are unitialized
      • setCurrentRow

        public void setCurrentRow(ExecRow currentRow,
                                  int resultSetNumber)
        Remember the row for the specified ResultSet.
        Specified by:
        setCurrentRow in interface Activation
        Parameters:
        currentRow - The row to be operated upon.
        resultSetNumber - The resultSetNumber for the current ResultSet
      • clearCurrentRow

        public void clearCurrentRow(int resultSetNumber)
        Clear the current row for the specified ResultSet.
        Specified by:
        clearCurrentRow in interface Activation
        Parameters:
        resultSetNumber - The resultSetNumber for the current ResultSet
      • getCurrentRow

        public Row getCurrentRow(int resultSetNumber)
        Get the current row at the given index.
        Specified by:
        getCurrentRow in interface Activation
      • setupSQLSessionContextForChildren

        public SQLSessionContext setupSQLSessionContextForChildren(boolean push)
        Description copied from interface: Activation
        Set up and return the current SQL session context for all immediately nested connections stemming from the call or function invocation of the statement corresponding to this activation (push=true) or for a substatement, which shares the parents statement's session context (push=false).
        Specified by:
        setupSQLSessionContextForChildren in interface Activation
        Parameters:
        push - true if used to push a new connection context
        See Also:
        Activation.setupSQLSessionContextForChildren(boolean)
      • setParentActivation

        public void setParentActivation(Activation a)
        This activation is created in a dynamic call context or a substatement execution context, make note of its parent statements activation (a).
        Specified by:
        setParentActivation in interface Activation
        Parameters:
        a - The caller's or superstatement's activation
      • getParentActivation

        public Activation getParentActivation()
        Get the activation of the calling statement or parent statement.
        Specified by:
        getParentActivation in interface Activation
        Returns:
        The parent's activation
      • getParentResultSet

        public java.util.Vector<TemporaryRowHolder> getParentResultSet(java.lang.String resultSetId)
        get the reference to parent table ResultSets, that will be needed by the referential action dependent table scans.
        Specified by:
        getParentResultSet in interface Activation
      • getParentResultSetKeys

        public java.util.Enumeration<java.lang.String> getParentResultSetKeys()
        Specified by:
        getParentResultSetKeys in interface Activation
      • clearParentResultSets

        public void clearParentResultSets()
        prepared statement use the same activation for multiple execution. For each excution we create new set of temporary resultsets, we should clear this hash table. otherwise we will refer to the released resources.
        Specified by:
        clearParentResultSets in interface Activation
      • setForUpdateIndexScan

        public void setForUpdateIndexScan(CursorResultSet forUpdateIndexScan)
        beetle 3865: updateable cursor using index. A way of communication between cursor activation and update activation.
        Specified by:
        setForUpdateIndexScan in interface Activation
      • getContextManager

        public ContextManager getContextManager()
        Get the Current ContextManager.
        Returns:
        Current ContextManager
      • getDataValueFactory

        public DataValueFactory getDataValueFactory()
        Used by activations to generate data values. Most DML statements will use this method. Possibly some DDL statements will, as well.
        Specified by:
        getDataValueFactory in interface Activation
        Returns:
        DataValueFactory
      • getCurrentConnection

        public java.sql.Connection getCurrentConnection()
                                                 throws java.sql.SQLException
        Used to get a proxy for the current connection.
        Throws:
        java.sql.SQLException - Thrown on failure to get connection
      • getDynamicResults

        public java.sql.ResultSet[][] getDynamicResults()
        Real implementations of this method are provided by a generated class.
        Specified by:
        getDynamicResults in interface Activation
        Returns:
        null if no dynamic results exists. Otherwise an array of ResultSet arrays, each of length one containing null or a reference to a ResultSet.
      • getMaxDynamicResults

        public int getMaxDynamicResults()
        Real implementations of this method are provided by a generated class.
        Specified by:
        getMaxDynamicResults in interface Activation
      • getDB2Length

        public NumberDataValue getDB2Length(DataValueDescriptor value,
                                            int constantLength,
                                            NumberDataValue reUse)
                                     throws StandardException
        Compute the DB2 compatible length of a value.
        Parameters:
        value -
        constantLength - The length, if it is a constant modulo null/not null. -1 if the length is not constant
        reUse - If non-null then re-use this as a container for the length
        Returns:
        the DB2 compatible length, set to null if value is null.
        Throws:
        StandardException
      • getDependableFinder

        public DependableFinder getDependableFinder()
        Description copied from interface: Dependable
        Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.
        Specified by:
        getDependableFinder in interface Dependable
        Returns:
        A Finder object that can be written to disk if this is a Persistent Dependable. Null if this is not a persistent dependable.
        See Also:
        Dependable.getDependableFinder()
      • getObjectName

        public java.lang.String getObjectName()
        Description copied from interface: Dependable
        Get the name of this Dependable OBJECT. This is useful for diagnostic messages.
        Specified by:
        getObjectName in interface Dependable
        Returns:
        Name of Dependable OBJECT.
        See Also:
        Dependable.getObjectName()
      • getClassType

        public java.lang.String getClassType()
        Description copied from interface: Dependable
        Get the unique class id for the Dependable. Every Dependable belongs to a class of Dependables.
        Specified by:
        getClassType in interface Dependable
        Returns:
        type of this Dependable.
        See Also:
        Dependable.getClassType()
      • isPersistent

        public boolean isPersistent()
        Description copied from interface: Dependable
        Return whether or not this Dependable is persistent. Persistent dependencies are stored in SYS.SYSDEPENDS.
        Specified by:
        isPersistent in interface Dependable
        Returns:
        true if this Dependable is persistent.
        See Also:
        Dependable.isPersistent()
      • isValid

        public boolean isValid()
        Description copied from interface: Dependent
        Check that all of the dependent's dependencies are valid.
        Specified by:
        isValid in interface Dependent
        Returns:
        true if the dependent is currently valid
        See Also:
        Dependent.isValid()

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.