1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.sql.Activation; 25 import org.apache.derby.iapi.error.StandardException; 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.ConglomerateDescriptor; 29 import org.apache.derby.iapi.sql.dictionary.DataDictionary; 30 import org.apache.derby.iapi.sql.depend.DependencyManager; 31 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 32 import org.apache.derby.iapi.store.access.TransactionController; 33 34 35 import org.apache.derby.catalog.UUID; 36 37 42 43 class DropStatisticsConstantAction extends DDLConstantAction 44 { 45 private final String objectName; 46 private final boolean forTable; 47 private final SchemaDescriptor sd; 48 private final String fullTableName; 49 50 DropStatisticsConstantAction(SchemaDescriptor sd, 51 String fullTableName, 52 String objectName, 53 boolean forTable) 54 { 55 this.objectName = objectName; 56 this.sd = sd; 57 this.forTable = forTable; 58 this.fullTableName = fullTableName; 59 } 60 61 public void executeConstantAction(Activation activation) 62 throws StandardException 63 { 64 TableDescriptor td; 65 ConglomerateDescriptor cd = null; 66 67 LanguageConnectionContext lcc = activation.getLanguageConnectionContext(); 68 DataDictionary dd = lcc.getDataDictionary(); 69 DependencyManager dm = dd.getDependencyManager(); 70 TransactionController tc = lcc.getTransactionExecute(); 71 72 73 dd.startWriting(lcc); 74 75 if (forTable) 76 { 77 td = dd.getTableDescriptor(objectName, sd); 78 } 79 80 else 81 { 82 cd = dd.getConglomerateDescriptor(objectName, 83 sd, false); 84 td = dd.getTableDescriptor(cd.getTableID()); 85 } 86 87 91 dm.invalidateFor(td, DependencyManager.DROP_STATISTICS, lcc); 92 93 dd.dropStatisticsDescriptors(td.getUUID(), ((cd != null) ? cd.getUUID() : 94 null), tc); 95 } 96 97 public String toString() 98 { 99 return "DROP STATISTICS FOR " + ((forTable) ? "table " : "index ") + 100 fullTableName; 101 } 102 } 103 104 | Popular Tags |