001: /*
002:
003: Derby - Class org.apache.derby.impl.sql.compile.DropViewNode
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.impl.sql.compile;
023:
024: import org.apache.derby.iapi.services.context.ContextManager;
025:
026: import org.apache.derby.iapi.sql.execute.ConstantAction;
027:
028: import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
029: import org.apache.derby.impl.sql.execute.BaseActivation;
030: import org.apache.derby.iapi.sql.ResultSet;
031:
032: import org.apache.derby.iapi.error.StandardException;
033: import org.apache.derby.iapi.sql.compile.CompilerContext;
034: import org.apache.derby.iapi.sql.dictionary.DataDictionary;
035: import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
036: import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
037:
038: import org.apache.derby.iapi.services.sanity.SanityManager;
039:
040: /**
041: * A DropViewNode is the root of a QueryTree that represents a DROP VIEW
042: * statement.
043: *
044: * @author Jerry Brenner
045: */
046:
047: public class DropViewNode extends DDLStatementNode {
048:
049: /**
050: * Initializer for a DropViewNode
051: *
052: * @param dropObjectName The name of the object being dropped
053: *
054: */
055:
056: public void init(Object dropObjectName) throws StandardException {
057: initAndCheck(dropObjectName);
058: }
059:
060: public String statementToString() {
061: return "DROP VIEW";
062: }
063:
064: /**
065: * Bind the drop view node
066: *
067: * @return The bound query tree
068: *
069: * @exception StandardException Thrown on error
070: */
071:
072: public QueryTreeNode bind() throws StandardException {
073: DataDictionary dd = getDataDictionary();
074: CompilerContext cc = getCompilerContext();
075:
076: TableDescriptor td = dd.getTableDescriptor(getRelativeName(),
077: getSchemaDescriptor());
078:
079: /*
080: * Statement is dependent on the TableDescriptor
081: * If td is null, let execution throw the error like
082: * it is before.
083: */
084: if (td != null) {
085: cc.createDependency(td);
086: }
087:
088: return this ;
089: }
090:
091: // inherit generate() method from DDLStatementNode
092:
093: /**
094: * Create the Constant information that will drive the guts of Execution.
095: *
096: * @exception StandardException Thrown on failure
097: */
098: public ConstantAction makeConstantAction() throws StandardException {
099: return getGenericConstantActionFactory()
100: .getDropViewConstantAction(getFullName(),
101: getRelativeName(), getSchemaDescriptor());
102: }
103: }
|