Class DefaultVTIModDeferPolicy

java.lang.Object
org.apache.derby.impl.sql.compile.DefaultVTIModDeferPolicy
All Implemented Interfaces:
DeferModification

class DefaultVTIModDeferPolicy extends Object implements DeferModification
This class implements the default policy for defering modifications to virtual tables.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final String
     
    private final boolean
     

    Fields inherited from interface org.apache.derby.vti.DeferModification

    DELETE_STATEMENT, INSERT_STATEMENT, UPDATE_STATEMENT
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultVTIModDeferPolicy(String targetVTIClassName, boolean VTIResultSetIsSensitive)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    alwaysDefer(int statementType)
    This method is called during preparation of an insert, update, or delete statement with this VTI as the target.
    boolean
    columnRequiresDefer(int statementType, String columnName, boolean inWhereClause)
    This method is called during preparation of an update or delete statement on the virtual table if getResultSetType() returns ResultSet.TYPE_SCROLL_SENSITIVE or TYPE_SCROLL_SENSITIVE and alwaysDefer( statementType) returns false.
    void
    modificationNotify(int statementType, boolean deferred)
    This VTI method is called by Derby when a VTI modification (insert, update, or delete) is executed.
    boolean
    subselectRequiresDefer(int statementType, String VTIClassName)
    This method is called during preparation of an insert, update, or delete statement that has this virtual table as its target and that has a sub-select.
    boolean
    subselectRequiresDefer(int statementType, String schemaName, String tableName)
    This method is called during preparation of an insert, update, or delete statement that has this virtual table as its target and that has a sub-select.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • targetVTIClassName

      private final String targetVTIClassName
    • VTIResultSetIsSensitive

      private final boolean VTIResultSetIsSensitive
  • Constructor Details

    • DefaultVTIModDeferPolicy

      DefaultVTIModDeferPolicy(String targetVTIClassName, boolean VTIResultSetIsSensitive)
  • Method Details

    • alwaysDefer

      public boolean alwaysDefer(int statementType)
      Description copied from interface: DeferModification
      This method is called during preparation of an insert, update, or delete statement with this VTI as the target. It indicates whether the statement should be deferred irregardless of the other clauses in the statement. If alwaysDefer returns true then the other methods in this interface are not called. (At least not for this statement type).
      Specified by:
      alwaysDefer in interface DeferModification
      Parameters:
      statementType - One of INSERT_STATEMENT, UPDATE_STATEMENT, DELETE_STATEMENT.
      Returns:
      true if the statement type should always be deferred on this VTI, false other criteria (see below) should be examined to determine whether to defer the modification.
      See Also:
    • columnRequiresDefer

      public boolean columnRequiresDefer(int statementType, String columnName, boolean inWhereClause)
      Description copied from interface: DeferModification
      This method is called during preparation of an update or delete statement on the virtual table if getResultSetType() returns ResultSet.TYPE_SCROLL_SENSITIVE or TYPE_SCROLL_SENSITIVE and alwaysDefer( statementType) returns false. ColumnRequiresDefer is called once for each column that is being updated, or each column in a DELETE where clause until it returns true or until all the columns have been exhausted.
      Specified by:
      columnRequiresDefer in interface DeferModification
      Parameters:
      statementType - UPDATE_STATEMENT or DELETE_STATEMENT.
      columnName - the name of one of the columns being updated
      inWhereClause - indicates whether the column also appears in the where clause
      Returns:
      true if the update must be deferred false if this column does not require a deferred update
      See Also:
    • subselectRequiresDefer

      public boolean subselectRequiresDefer(int statementType, String schemaName, String tableName)
      Description copied from interface: DeferModification
      This method is called during preparation of an insert, update, or delete statement that has this virtual table as its target and that has a sub-select. It is invoked once for each regular table in a sub-select, if it has not already been determined that the statement should be deferred or that the VTI does not support deferral.
      Specified by:
      subselectRequiresDefer in interface DeferModification
      Parameters:
      statementType - the statement type: INSERT_STATEMENT, UPDATE_STATEMENT, or DELETE_STATEMENT.
      schemaName - the schema of the table in the sub-select.
      tableName - the name of the table in the sub-select.
      Returns:
      true if the modification must be deferred false if this source table does not necessitate a deferred modification
      See Also:
    • subselectRequiresDefer

      public boolean subselectRequiresDefer(int statementType, String VTIClassName)
      Description copied from interface: DeferModification
      This method is called during preparation of an insert, update, or delete statement that has this virtual table as its target and that has a sub-select. It is invoked once for each virtual table in the sub-select, if it has not already been determined that the statement should be deferred or that the VTI does not support deferral.
      Specified by:
      subselectRequiresDefer in interface DeferModification
      Parameters:
      statementType - the statement type: INSERT_STATEMENT, UPDATE_STATEMENT, or DELETE_STATEMENT.
      VTIClassName - the name of the class implementing the VTI in the sub-select.
      Returns:
      true if the modification must be deferred false if this source table does not necessitate a deferred modification
      See Also:
    • modificationNotify

      public void modificationNotify(int statementType, boolean deferred)
      Description copied from interface: DeferModification
      This VTI method is called by Derby when a VTI modification (insert, update, or delete) is executed. It is called after the VTI has been instantiated but before any rows are read, inserted, updated, or deleted.
      Specified by:
      modificationNotify in interface DeferModification
      Parameters:
      statementType - one of INSERT_STATEMENT, UPDATE_STATEMENT, or DELETE_STATEMENT
      deferred - true if the modification will be deferred, false if not.