|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.farrago.ddl.DdlStmt net.sf.farrago.ddl.DdlReloadTableStmt net.sf.farrago.ddl.DdlAlterTableStructureStmt
public class DdlAlterTableStructureStmt
DdlAlterTableStructureStmt represents an ALTER TABLE statement which adds/drops columns or changes their datatype, implying that stored tuples may need to be reshaped. Currently it can only handle addition of a new column at the end. It extends DdlRebuildTableStmt since the default implementation for the reshape is to rebuild the entire table by copying from the old structure to the new.
Field Summary | |
---|---|
private CwmTable |
origTable
|
Constructor Summary | |
---|---|
DdlAlterTableStructureStmt(FarragoRepos repos,
CwmTable table)
|
Method Summary | |
---|---|
private RefObject |
cloneRefObj(JmiModelGraph oldModelGraph,
JmiModelGraph newModelGraph,
RefObject oldObj)
Clones an object from one repository to another, sort of. |
void |
completeAfterExecuteUnlocked(FarragoSessionDdlValidator ddlValidator,
FarragoSession session,
boolean success)
Provides access to the repository after execution of the DDL. |
private static void |
deleteGrants(FarragoRepos repos,
CwmModelElement element)
|
private static void |
deleteModelElement(FarragoRepos repos,
CwmModelElement element)
|
protected CwmTable |
getOldTableStructureForIndexMap()
|
protected String |
getReloadDml(SqlPrettyWriter writer)
Generates the SQL to be used to reload the table. |
void |
prepForExecuteUnlocked(FarragoSessionDdlValidator ddlValidator,
FarragoSession session)
Provides access to the repository in preparation for the execution of DdlStmt. |
void |
preValidate(FarragoSessionDdlValidator ddlValidator)
Called before generic validation. |
static void |
recover(FarragoRepos repos,
CwmTable failedTable)
Recovers after a problem (either execution failure or system crash) while a table was being altered. |
protected void |
recoverFromFailure(FarragoSessionDdlValidator ddlValidator,
FarragoSession session)
Called after an exception is thrown during the execution phase. |
protected boolean |
shouldRebuildIndexes(FarragoSessionDdlValidator ddlValidator)
Determines whether statement execution should rebuild all indexes on the table. |
Methods inherited from class net.sf.farrago.ddl.DdlReloadTableStmt |
---|
completeRequiresWriteTxn, executeUnlocked, getTable, setRecoveryRef, visit |
Methods inherited from class net.sf.farrago.ddl.DdlStmt |
---|
getModelElement, isDropRestricted, postCommit, postExecute, preExecute, requiresCommit, runsAsDml |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.farrago.session.FarragoSessionDdlStmt |
---|
getModelElement, isDropRestricted, postCommit, postExecute, preExecute, requiresCommit, runsAsDml |
Field Detail |
---|
private CwmTable origTable
Constructor Detail |
---|
public DdlAlterTableStructureStmt(FarragoRepos repos, CwmTable table)
Method Detail |
---|
private RefObject cloneRefObj(JmiModelGraph oldModelGraph, JmiModelGraph newModelGraph, RefObject oldObj)
TODO jvs 4-Dec-2008: make this handle more cases generically and then promote it to JmiObjUtil.
oldModelGraph
- model graph for the old repositorynewModelGraph
- model graph for the new repositoryoldObj
- object to be cloned
public void prepForExecuteUnlocked(FarragoSessionDdlValidator ddlValidator, FarragoSession session)
DdlMultipleTransactionStmt
prepForExecuteUnlocked
in interface DdlMultipleTransactionStmt
prepForExecuteUnlocked
in class DdlReloadTableStmt
ddlValidator
- DDL validator for this statementFarragoReposTxnContext
protected CwmTable getOldTableStructureForIndexMap()
getOldTableStructureForIndexMap
in class DdlReloadTableStmt
public void preValidate(FarragoSessionDdlValidator ddlValidator)
FarragoSessionDdlStmt
preValidate
in interface FarragoSessionDdlStmt
preValidate
in class DdlStmt
ddlValidator
- the object validating this stmtprotected boolean shouldRebuildIndexes(FarragoSessionDdlValidator ddlValidator)
DdlReloadTableStmt
shouldRebuildIndexes
in class DdlReloadTableStmt
ddlValidator
- validator for this DDL statement
public static void recover(FarragoRepos repos, CwmTable failedTable)
repos
- repository containing table definitionfailedTable
- table to recoverprivate static void deleteModelElement(FarragoRepos repos, CwmModelElement element)
private static void deleteGrants(FarragoRepos repos, CwmModelElement element)
protected void recoverFromFailure(FarragoSessionDdlValidator ddlValidator, FarragoSession session)
DdlReloadTableStmt
recoverFromFailure
in class DdlReloadTableStmt
ddlValidator
- DDL validator for this statementsession
- reentrant Farrago sessionpublic void completeAfterExecuteUnlocked(FarragoSessionDdlValidator ddlValidator, FarragoSession session, boolean success)
DdlMultipleTransactionStmt
DdlMultipleTransactionStmt.executeUnlocked(FarragoSessionDdlValidator, FarragoSession)
.
This method is invoked in a locked
repository
transaction. The method DdlMultipleTransactionStmt.completeRequiresWriteTxn()
controls
whether the transaction read-only or not. This method may not access
and/or modify repository objects loaded in a previous transaction unless
they are reloaded by MOF ID. Be aware that objects may have been modified
by another session unless some external mechanism (for instance, the
"table-in-use" collection) guarantees that they have not been modified by
another statement.
Note that any repository modifications made during the execution of
this method will not be post-processed by DdlValidator
.
For instance, DdlValidator.checkJmiConstraints(RefObject)
is not
called, and therefore any mandatory default primitives are not
automatically set, which will cause errors later if the attributes have
not been explicitly initialized. See JmiObjUtil.setMandatoryPrimitiveDefaults(javax.jmi.reflect.RefObject)
.
completeAfterExecuteUnlocked
in interface DdlMultipleTransactionStmt
completeAfterExecuteUnlocked
in class DdlReloadTableStmt
ddlValidator
- DDL validator for this statementsession
- reentrant Farrago session which may be used to execute DML
statementssuccess
- whether the execution succeeded; detection of failure can
be used to recoverprotected String getReloadDml(SqlPrettyWriter writer)
DdlReloadTableStmt
getReloadDml
in class DdlReloadTableStmt
writer
- writer to uses for generating SQL
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |