1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 26 import org.apache.derby.iapi.error.StandardException; 27 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 28 29 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor; 30 import org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator; 31 import org.apache.derby.iapi.sql.dictionary.DataDictionary; 32 import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext; 33 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor; 34 import org.apache.derby.iapi.sql.dictionary.TableDescriptor; 35 import org.apache.derby.iapi.sql.dictionary.ViewDescriptor; 36 37 import org.apache.derby.iapi.sql.depend.DependencyManager; 38 39 import org.apache.derby.iapi.reference.SQLState; 40 41 import org.apache.derby.iapi.sql.execute.ConstantAction; 42 43 import org.apache.derby.iapi.sql.Activation; 44 45 import org.apache.derby.iapi.store.access.TransactionController; 46 47 import org.apache.derby.catalog.UUID; 48 49 55 56 class DropViewConstantAction extends DDLConstantAction 57 { 58 59 private String fullTableName; 60 private String tableName; 61 private SchemaDescriptor sd; 62 63 65 74 DropViewConstantAction( 75 String fullTableName, 76 String tableName, 77 SchemaDescriptor sd ) 78 { 79 this.fullTableName = fullTableName; 80 this.tableName = tableName; 81 this.sd = sd; 82 83 if (SanityManager.DEBUG) 84 { 85 SanityManager.ASSERT(sd != null, "SchemaDescriptor is null"); 86 } 87 } 88 89 91 public String toString() 92 { 93 return "DROP VIEW " + fullTableName; 96 } 97 98 100 101 108 public void executeConstantAction( Activation activation ) 109 throws StandardException 110 { 111 TableDescriptor td; 112 ViewDescriptor vd; 113 114 LanguageConnectionContext lcc = activation.getLanguageConnectionContext(); 115 DataDictionary dd = lcc.getDataDictionary(); 116 DependencyManager dm = dd.getDependencyManager(); 117 TransactionController tc = lcc.getTransactionExecute(); 118 119 128 dd.startWriting(lcc); 129 130 133 td = dd.getTableDescriptor(tableName, sd); 134 135 if (td == null) 136 { 137 throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND_DURING_EXECUTION, fullTableName); 138 } 139 140 141 if (td.getTableType() != TableDescriptor.VIEW_TYPE) 142 { 143 throw StandardException.newException(SQLState.LANG_DROP_VIEW_ON_NON_VIEW, fullTableName); 144 } 145 146 vd = dd.getViewDescriptor(td); 147 148 vd.dropViewWork(dd, dm, lcc, tc, sd, td, false); 149 } 150 } 151 | Popular Tags |