KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > compile > DefaultVTIModDeferPolicy


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.compile.DefaultVTIModDeferPolicy
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.sql.compile;
23
24 import org.apache.derby.vti.DeferModification;
25
26 /**
27  * This class implements the default policy for defering modifications to virtual
28  * tables.
29  */

30 class DefaultVTIModDeferPolicy implements DeferModification
31 {
32     private final String JavaDoc targetVTIClassName;
33     private final boolean VTIResultSetIsSensitive;
34
35     DefaultVTIModDeferPolicy( String JavaDoc targetVTIClassName,
36                               boolean VTIResultSetIsSensitive)
37     {
38         this.targetVTIClassName = targetVTIClassName;
39         this.VTIResultSetIsSensitive = VTIResultSetIsSensitive;
40     }
41
42     /**
43      * @see org.apache.derby.vti.DeferModification#alwaysDefer
44      */

45     public boolean alwaysDefer( int statementType)
46     {
47         return false;
48     }
49           
50     /**
51      * @see org.apache.derby.vti.DeferModification#columnRequiresDefer
52      */

53     public boolean columnRequiresDefer( int statementType,
54                                         String JavaDoc columnName,
55                                         boolean inWhereClause)
56     {
57         switch( statementType)
58         {
59         case DeferModification.INSERT_STATEMENT:
60             return false;
61
62         case DeferModification.UPDATE_STATEMENT:
63             return VTIResultSetIsSensitive && inWhereClause;
64
65         case DeferModification.DELETE_STATEMENT:
66             return false;
67         }
68         return false; // Should not get here.
69
} // end of columnRequiresDefer
70

71     /**
72      * @see org.apache.derby.vti.DeferModification#subselectRequiresDefer(int,String,String)
73      */

74     public boolean subselectRequiresDefer( int statementType,
75                                            String JavaDoc schemaName,
76                                            String JavaDoc tableName)
77     {
78         return false;
79     } // end of subselectRequiresDefer( statementType, schemaName, tableName)
80

81     /**
82      * @see org.apache.derby.vti.DeferModification#subselectRequiresDefer(int, String)
83      */

84     public boolean subselectRequiresDefer( int statementType,
85                                            String JavaDoc VTIClassName)
86     {
87         return targetVTIClassName.equals( VTIClassName);
88     } // end of subselectRequiresDefer( statementType, VTIClassName)
89

90     public void modificationNotify( int statementType,
91                                     boolean deferred)
92     {}
93 }
94
Popular Tags