{
if (tempTableInfo.getDroppedInSavepointLevel() == -1)
{
//the table was declared but not dropped in the unit of work getting rolled back and hence we will remove
//it from valid list of temporary tables and drop the conglomerate associated with it
TableDescriptor td = tempTableInfo.getTableDescriptor();
tran.dropConglomerate(td.getHeapConglomerateId()); //remove the conglomerate created for this temp table
allDeclaredGlobalTempTables.remove(i); //remove it from the list of temp tables
} else if (tempTableInfo.getDroppedInSavepointLevel() >= currentSavepointLevel)
{
//the table was declared and dropped in the unit of work getting rolled back
allDeclaredGlobalTempTables.remove(i);
}
} else if (tempTableInfo.getDroppedInSavepointLevel() >= currentSavepointLevel) //this means the table was declared in an earlier savepoint unit / transaction and then dropped in current UOW
{
//restore the old definition of temp table because drop is being rolledback
TableDescriptor td = tempTableInfo.getTableDescriptor();
td = cleanupTempTableOnCommitOrRollback(td, false);
//In order to store the old conglomerate information for the temp table, we need to replace the
//existing table descriptor with the old table descriptor which has the old conglomerate information
tempTableInfo.setTableDescriptor(td);
tempTableInfo.setDroppedInSavepointLevel(-1);
//following will mark the table as not modified. This is because the table data has been deleted as part of the current rollback
tempTableInfo.setModifiedInSavepointLevel(-1);
allDeclaredGlobalTempTables.set(i, tempTableInfo);
} else if (tempTableInfo.getModifiedInSavepointLevel() >= currentSavepointLevel) //this means the table was declared in an earlier savepoint unit / transaction and modified in current UOW
{
//following will mark the table as not modified. This is because the table data will be deleted as part of the current rollback
tempTableInfo.setModifiedInSavepointLevel(-1);
TableDescriptor td = tempTableInfo.getTableDescriptor();
getDataDictionary().getDependencyManager().invalidateFor(td, DependencyManager.DROP_TABLE, this);
cleanupTempTableOnCommitOrRollback(td, true);
} // there is no else here because there is no special processing required for temp tables declares in earlier work of unit/transaction and not modified
}