Class DefaultVTIModDeferPolicy
- java.lang.Object
-
- org.apache.derby.impl.sql.compile.DefaultVTIModDeferPolicy
-
- All Implemented Interfaces:
DeferModification
class DefaultVTIModDeferPolicy extends java.lang.Object implements DeferModification
This class implements the default policy for defering modifications to virtual tables.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
targetVTIClassName
private boolean
VTIResultSetIsSensitive
-
Fields inherited from interface org.apache.derby.vti.DeferModification
DELETE_STATEMENT, INSERT_STATEMENT, UPDATE_STATEMENT
-
-
Constructor Summary
Constructors Constructor Description DefaultVTIModDeferPolicy(java.lang.String targetVTIClassName, boolean VTIResultSetIsSensitive)
-
Method Summary
All Methods Instance Methods Concrete Methods 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, java.lang.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, java.lang.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, java.lang.String schemaName, java.lang.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.
-
-
-
Method Detail
-
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 interfaceDeferModification
- 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:
DeferModification.alwaysDefer(int)
-
columnRequiresDefer
public boolean columnRequiresDefer(int statementType, java.lang.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 interfaceDeferModification
- Parameters:
statementType
- UPDATE_STATEMENT or DELETE_STATEMENT.columnName
- the name of one of the columns being updatedinWhereClause
- 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:
DeferModification.columnRequiresDefer(int, java.lang.String, boolean)
-
subselectRequiresDefer
public boolean subselectRequiresDefer(int statementType, java.lang.String schemaName, java.lang.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 interfaceDeferModification
- 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:
DeferModification.subselectRequiresDefer(int,String,String)
-
subselectRequiresDefer
public boolean subselectRequiresDefer(int statementType, java.lang.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 interfaceDeferModification
- 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:
DeferModification.subselectRequiresDefer(int, String)
-
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 interfaceDeferModification
- Parameters:
statementType
- one of INSERT_STATEMENT, UPDATE_STATEMENT, or DELETE_STATEMENTdeferred
- true if the modification will be deferred, false if not.
-
-