KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.compile.DropViewNode
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.iapi.services.context.ContextManager;
25
26 import org.apache.derby.iapi.sql.execute.ConstantAction;
27
28 import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
29 import org.apache.derby.impl.sql.execute.BaseActivation;
30 import org.apache.derby.iapi.sql.ResultSet;
31
32 import org.apache.derby.iapi.error.StandardException;
33 import org.apache.derby.iapi.sql.compile.CompilerContext;
34 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
35 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
36 import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
37
38 import org.apache.derby.iapi.services.sanity.SanityManager;
39
40 /**
41  * A DropViewNode is the root of a QueryTree that represents a DROP VIEW
42  * statement.
43  *
44  * @author Jerry Brenner
45  */

46
47 public class DropViewNode extends DDLStatementNode
48 {
49
50     /**
51      * Initializer for a DropViewNode
52      *
53      * @param dropObjectName The name of the object being dropped
54      *
55      */

56
57     public void init(Object JavaDoc dropObjectName)
58         throws StandardException
59     {
60         initAndCheck(dropObjectName);
61     }
62
63     public String JavaDoc statementToString()
64     {
65         return "DROP VIEW";
66     }
67
68     /**
69      * Bind the drop view node
70      *
71      * @return The bound query tree
72      *
73      * @exception StandardException Thrown on error
74      */

75     
76     public QueryTreeNode bind() throws StandardException
77     {
78         DataDictionary dd = getDataDictionary();
79         CompilerContext cc = getCompilerContext();
80                 
81         TableDescriptor td = dd.getTableDescriptor(getRelativeName(),
82                     getSchemaDescriptor());
83     
84         /*
85          * Statement is dependent on the TableDescriptor
86          * If td is null, let execution throw the error like
87          * it is before.
88          */

89         if (td != null)
90         {
91             cc.createDependency(td);
92         }
93             
94         return this;
95     }
96         
97     
98     // inherit generate() method from DDLStatementNode
99

100
101     /**
102      * Create the Constant information that will drive the guts of Execution.
103      *
104      * @exception StandardException Thrown on failure
105      */

106     public ConstantAction makeConstantAction() throws StandardException
107     {
108         return getGenericConstantActionFactory().getDropViewConstantAction( getFullName(),
109                                              getRelativeName(),
110                                              getSchemaDescriptor());
111     }
112 }
113
Popular Tags