use of org.apache.derby.iapi.store.access.TransactionController in project derby by apache.
the class DropSchemaConstantAction method executeConstantAction.
// INTERFACE METHODS
/**
* This is the guts of the Execution-time logic for DROP TABLE.
*
* @see ConstantAction#executeConstantAction
*
* @exception StandardException Thrown on failure
*/
public void executeConstantAction(Activation activation) throws StandardException {
LanguageConnectionContext lcc = activation.getLanguageConnectionContext();
DataDictionary dd = lcc.getDataDictionary();
TransactionController tc = lcc.getTransactionExecute();
/*
** Inform the data dictionary that we are about to write to it.
** There are several calls to data dictionary "get" methods here
** that might be done in "read" mode in the data dictionary, but
** it seemed safer to do this whole operation in "write" mode.
**
** We tell the data dictionary we're done writing at the end of
** the transaction.
*/
dd.startWriting(lcc);
SchemaDescriptor sd = dd.getSchemaDescriptor(schemaName, tc, true);
sd.drop(lcc, activation);
}
use of org.apache.derby.iapi.store.access.TransactionController in project derby by apache.
the class DropStatisticsConstantAction method executeConstantAction.
public void executeConstantAction(Activation activation) throws StandardException {
TableDescriptor td;
ConglomerateDescriptor cd = null;
LanguageConnectionContext lcc = activation.getLanguageConnectionContext();
DataDictionary dd = lcc.getDataDictionary();
DependencyManager dm = dd.getDependencyManager();
TransactionController tc = lcc.getTransactionExecute();
dd.startWriting(lcc);
if (forTable) {
td = dd.getTableDescriptor(objectName, sd, tc);
} else {
cd = dd.getConglomerateDescriptor(objectName, sd, false);
td = dd.getTableDescriptor(cd.getTableID());
}
/* invalidate all SPS's on the table-- bad plan on SPS, so user drops
* statistics and would want SPS's invalidated so that recompile would
* give good plans; thats the theory anyways....
*/
dm.invalidateFor(td, DependencyManager.DROP_STATISTICS, lcc);
dd.dropStatisticsDescriptors(td.getUUID(), ((cd != null) ? cd.getUUID() : null), tc);
}
use of org.apache.derby.iapi.store.access.TransactionController in project derby by apache.
the class DropTriggerConstantAction method executeConstantAction.
/**
* This is the guts of the Execution-time logic for DROP STATEMENT.
*
* @see ConstantAction#executeConstantAction
*
* @exception StandardException Thrown on failure
*/
public void executeConstantAction(Activation activation) throws StandardException {
TriggerDescriptor triggerd;
LanguageConnectionContext lcc = activation.getLanguageConnectionContext();
DataDictionary dd = lcc.getDataDictionary();
/*
** Inform the data dictionary that we are about to write to it.
** There are several calls to data dictionary "get" methods here
** that might be done in "read" mode in the data dictionary, but
** it seemed safer to do this whole operation in "write" mode.
**
** We tell the data dictionary we're done writing at the end of
** the transaction.
*/
dd.startWriting(lcc);
TableDescriptor td = dd.getTableDescriptor(tableId);
if (td == null) {
throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND_DURING_EXECUTION, tableId.toString());
}
TransactionController tc = lcc.getTransactionExecute();
lockTableForDDL(tc, td.getHeapConglomerateId(), true);
// get td again in case table shape is changed before lock is acquired
td = dd.getTableDescriptor(tableId);
if (td == null) {
throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND_DURING_EXECUTION, tableId.toString());
}
/*
** Get the trigger descriptor. We're responsible for raising
** the error if it isn't found
*/
triggerd = dd.getTriggerDescriptor(triggerName, sd);
if (triggerd == null) {
throw StandardException.newException(SQLState.LANG_OBJECT_NOT_FOUND_DURING_EXECUTION, "TRIGGER", (sd.getSchemaName() + "." + triggerName));
}
/*
** Prepare all dependents to invalidate. (This is there chance
** to say that they can't be invalidated. For example, an open
** cursor referencing a table/trigger that the user is attempting to
** drop.) If no one objects, then invalidate any dependent objects.
*/
triggerd.drop(lcc);
}
use of org.apache.derby.iapi.store.access.TransactionController in project derby by apache.
the class D_DiagnosticUtil method diag_containerid_to_conglomid.
public static long diag_containerid_to_conglomid(Object module, long containerid) {
String ret_string = null;
AccessFactory store_module = null;
long conglom_id = Long.MIN_VALUE;
// Find the AccessFactory
store_module = (AccessFactory) getServiceModule(module, AccessFactory.MODULE);
if (store_module != null) {
try {
TransactionController tc = store_module.getTransaction(FileContainer.getContextService().getCurrentContextManager());
conglom_id = tc.findConglomid(containerid);
} catch (Throwable t) {
t.printStackTrace();
// on error just return the initialized bad value conglom_id
}
} else {
// during access boot this does not exist, assume for now that
// is why we got here. RESOLVE - it would be nice if we could
// actuallly figure that is why we failed.
/*
System.out.println(
"Could not find module for module: " + module);
*/
}
return (conglom_id);
}
use of org.apache.derby.iapi.store.access.TransactionController in project derby by apache.
the class D_DiagnosticUtil method diag_conglomid_to_containerid.
public static long diag_conglomid_to_containerid(Object module, long conglomid) {
String ret_string = null;
AccessFactory store_module = null;
long container_id = Long.MIN_VALUE;
// Find the AccessFactory
store_module = (AccessFactory) getServiceModule(module, AccessFactory.MODULE);
if (store_module != null) {
try {
TransactionController tc = store_module.getTransaction(FileContainer.getContextService().getCurrentContextManager());
container_id = tc.findContainerid(conglomid);
} catch (Throwable t) {
t.printStackTrace();
// on error just return the initialized bad value conglom_id
}
} else {
// during access boot this does not exist, assume for now that
// is why we got here. RESOLVE - it would be nice if we could
// actuallly figure that is why we failed.
/*
System.out.println(
"Could not find module for module: " + module);
*/
}
return (container_id);
}
Aggregations