1 21 22 package org.apache.derby.impl.sql.compile; 23 24 import org.apache.derby.iapi.sql.compile.CompilerContext; 25 import org.apache.derby.iapi.sql.dictionary.DataDictionary; 26 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor; 27 import org.apache.derby.iapi.sql.dictionary.TableDescriptor; 28 import org.apache.derby.iapi.sql.dictionary.TriggerDescriptor; 29 import org.apache.derby.iapi.reference.SQLState; 30 import org.apache.derby.iapi.sql.execute.ConstantAction; 31 import org.apache.derby.iapi.error.StandardException; 32 import org.apache.derby.iapi.services.context.ContextManager; 33 import org.apache.derby.iapi.services.sanity.SanityManager; 34 35 41 public class DropTriggerNode extends DDLStatementNode 42 { 43 private TableDescriptor td; 44 45 public String statementToString() 46 { 47 return "DROP TRIGGER"; 48 } 49 50 58 public QueryTreeNode bind() throws StandardException 59 { 60 CompilerContext cc = getCompilerContext(); 61 DataDictionary dd = getDataDictionary(); 62 63 SchemaDescriptor sd = getSchemaDescriptor(); 64 65 TriggerDescriptor triggerDescriptor = null; 66 67 if (sd.getUUID() != null) 68 triggerDescriptor = dd.getTriggerDescriptor(getRelativeName(), sd); 69 70 if (triggerDescriptor == null) 71 { 72 throw StandardException.newException(SQLState.LANG_OBJECT_NOT_FOUND, "TRIGGER", getFullName()); 73 } 74 75 76 td = triggerDescriptor.getTableDescriptor(); 77 cc.createDependency(td); 78 cc.createDependency(triggerDescriptor); 79 80 return this; 81 } 82 83 85 90 public ConstantAction makeConstantAction() throws StandardException 91 { 92 return getGenericConstantActionFactory().getDropTriggerConstantAction( 93 getSchemaDescriptor(), 94 getRelativeName(), 95 td.getUUID()); 96 } 97 } 98 | Popular Tags |