Java Doc for DeferModification.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » vti » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.vti 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.derby.vti.DeferModification

All known Subclasses:   org.apache.derby.impl.sql.compile.DefaultVTIModDeferPolicy,
DeferModification
public interface DeferModification (Code)
This interface is implemented by a read/write VTI class that wants to control when modifications to the VTI are deferred, or to be notified that a it is to be modified. Consider the following statement:
UPDATE NEW myVTI(...) SET cost = cost + 10 WHERE cost < 15

Updating a column that is used in the WHERE clause might or might not give the VTI implementation trouble; the update might cause the same row to be selected more than once. This problem can be solved by building the complete list of rows to be updated and the new column values before updating any rows. The updates are applied after the list is built. This process is called "deferred update".

By default, updates on a VTI are deferred when the VTI ResultSet is scrollable (ResultSet.TYPE_SCROLL_SENSITIVE or TYPE_SCROLL_INSENSITIVE), and one or more of the following is true.

  1. One or more of the columns in the SET clause is also used in the WHERE clause and the VTI ResultSet is sensitive. We do not defer updates when the ResultSet is TYPE_SCROLL_INSENSITIVE because it is not necessary.
  2. The where clause contains a subselect on a VTI from the same class as the target VTI. We do not look at the VTI parameters, just the VTI class name.

By default, deletes on a VTI are deferred in a similar situation: when the VTI ResultSet is scrollable (ResultSet.TYPE_SCROLL_SENSITIVE or TYPE_SCROLL_INSENSITIVE), and the where clause contains a subselect on a VTI from the same class as the target VTI. We do not look at the VTI parameters, just the VTI class name.

By default, inserts into a VTI are deferred when the same VTI class is used as both the source and target. It does not depend on the scrollability of the VTI ResultSet because inserts can be deferred without scrolling the ResultSet.

If these defaults are not appropriate then the class implementing the VTI should also implement this interface (org.apache.derby.vti.DeferModification).

(A read/write VTI is implemented by a class that implements the java.sql.PreparedStatement interface, often by extending the UpdatableVTITemplate interface. @see UpdatableVTITemplate).

Update and delete statement deferral is implemented by scrolling the VTI's ResultSet. Therefore, updates and deletes on a VTI are never deferred unless the VTI's ResultSets are scrollable, even if the DeferModification interface methods return true. Therefore for an update or delete to be deferred the VTI getResultSetType() method must return ResultSet.TYPE_SCROLL_SENSITIVE or TYPE_SCROLL_INSENSITIVE and the VTI must produce scrollable java.sql.ResultSets that implement the getRow() and absolute() methods. If your VTI is implemented as an extension to UpdatableVTITemplate then you must override the getResultSetMethod: UpdatableVTITemplate.getResultSetType() throws an exception. If your VTI's ResultSets are implemented as extensions to VTITemplate then you must override the getRow() and absolute() methods: VTITemplate.getRow() and absolute() throw exceptions.

This interface is not used when the VTI is referenced only in a subselect; it is only used when a VTI appears as the target of an INSERT, UPDATE, or DELETE statement.



Field Summary
final public static  intDELETE_STATEMENT
    
final public static  intINSERT_STATEMENT
    
final public static  intUPDATE_STATEMENT
    


Method Summary
public  booleanalwaysDefer(int statementType)
     This method is called during preparation of an insert, update, or delete statement with this VTI as the target.
public  booleancolumnRequiresDefer(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.
public  voidmodificationNotify(int statementType, boolean deferred)
     This VTI method is called by Cloudscape when a VTI modification (insert, update, or delete) is executed.
public  booleansubselectRequiresDefer(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.
public  booleansubselectRequiresDefer(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.

Field Detail
DELETE_STATEMENT
final public static int DELETE_STATEMENT(Code)



INSERT_STATEMENT
final public static int INSERT_STATEMENT(Code)



UPDATE_STATEMENT
final public static int UPDATE_STATEMENT(Code)





Method Detail
alwaysDefer
public boolean alwaysDefer(int statementType) throws SQLException(Code)
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).
Parameters:
  statementType - One of INSERT_STATEMENT, UPDATE_STATEMENT, DELETE_STATEMENT. true if the statement type should always be deferred on this VTI,false other criteria (see below) should be examined to determinewhether to defer the modification.
exception:
  SQLException - on an unexpected condition.



columnRequiresDefer
public boolean columnRequiresDefer(int statementType, String columnName, boolean inWhereClause) throws SQLException(Code)
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.
Parameters:
  statementType - UPDATE_STATEMENT or DELETE_STATEMENT.
Parameters:
  columnName - the name of one of the columns being updated
Parameters:
  inWhereClause - indicates whether the column also appears in the where clause true if the update must be deferredfalse if this column does not require a deferred update
exception:
  SQLException - a parameter is invalid or there is another unexpected failure.



modificationNotify
public void modificationNotify(int statementType, boolean deferred) throws SQLException(Code)
This VTI method is called by Cloudscape 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.
Parameters:
  statementType - one of INSERT_STATEMENT, UPDATE_STATEMENT, or DELETE_STATEMENT
Parameters:
  deferred - true if the modification will be deferred, false if not.
exception:
  SQLException - thrown on an unexpected failure



subselectRequiresDefer
public boolean subselectRequiresDefer(int statementType, String schemaName, String tableName) throws SQLException(Code)
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.
Parameters:
  statementType - the statement type: INSERT_STATEMENT, UPDATE_STATEMENT, or DELETE_STATEMENT.
Parameters:
  schemaName - the schema of the table in the sub-select.
Parameters:
  tableName - the name of the table in the sub-select. true if the modification must be deferredfalse if this source table does not necessitate a deferred modification
exception:
  SQLException - a parameter is invalid or there is another unexpected failure.



subselectRequiresDefer
public boolean subselectRequiresDefer(int statementType, String VTIClassName) throws SQLException(Code)
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.
Parameters:
  statementType - the statement type: INSERT_STATEMENT, UPDATE_STATEMENT, or DELETE_STATEMENT.
Parameters:
  VTIClassName - the name of the class implementing the VTI in the sub-select. true if the modification must be deferredfalse if this source table does not necessitate a deferred modification
exception:
  SQLException - a parameter is invalid or there is another unexpected failure.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.