|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.execute.GenericConstantAction
org.apache.derby.impl.sql.execute.DDLConstantAction
org.apache.derby.impl.sql.execute.DDLSingleTableConstantAction
org.apache.derby.impl.sql.execute.AlterTableConstantAction
This class describes actions that are ALWAYS performed for an ALTER TABLE Statement at Execution time.
Fields inherited from interface org.apache.derby.iapi.sql.execute.ConstantAction |
RUNTIMESTATISTICS, STATISTICSTIMING |
Constructor Summary | |
(package private) |
AlterTableConstantAction(SchemaDescriptor sd,
java.lang.String tableName,
UUID tableId,
long tableConglomerateId,
int tableType,
ColumnInfo[] columnInfo,
ConstraintConstantAction[] constraintActions,
char lockGranularity,
boolean compressTable,
int behavior,
boolean sequential,
boolean truncateTable)
Make the AlterAction for an ALTER TABLE statement. |
Method Summary | |
private void |
addNewColumnToTable(Activation activation,
int ix)
Workhorse for adding a new column to a table. |
void |
cleanUp()
|
private void |
closeBulkFetchScan()
|
void |
closeRowSource()
closeRowSource tells the RowSource that it will no longer need to return any rows and it can release any resource it may have. |
private java.lang.Object[] |
compressIndexArrays(long[] indexCIDS,
IndexRowGenerator[] irgs)
Get rid of duplicates from a set of index conglomerate numbers and index descriptors. |
private void |
compressTable(Activation activation)
|
private void |
dropAllColumnDefaults(UUID tableId,
DataDictionary dd)
|
private void |
dropColumnFromTable(Activation activation,
int ix)
Workhorse for dropping a column from a table. |
void |
execGuts(Activation activation)
Wrapper for this DDL action. |
void |
executeConstantAction(Activation activation)
This is the guts of the Execution-time logic for ALTER TABLE. |
private static void |
executeUpdate(LanguageConnectionContext lcc,
java.lang.String updateStmt)
|
private void |
getAffectedIndexes(Activation activation)
Get info on the indexes on the table being compress. |
private long |
getColumnMax(Activation activation,
TableDescriptor td,
java.lang.String columnName,
long increment,
long initial)
computes the minimum/maximum value in a column of a table. |
DataValueDescriptor[] |
getNextRowFromRowSource()
Get the next row as an array of column objects. |
private int |
getSemiRowCount(TransactionController tc)
Return the "semi" row count of a table. |
FormatableBitSet |
getValidColumns()
getValidColumns describes the DataValueDescriptor[] returned by all calls to the getNextRowFromRowSource() call. |
private void |
insertIntoSorter(int index,
RowLocation rl)
|
boolean |
modifiesTableId(UUID tableId)
Does this constant action modify the passed in table uuid? |
private void |
modifyColumnConstraint(Activation activation,
java.lang.String colName,
boolean nullability)
Workhorse for modifying column level constraints. |
private void |
modifyColumnDefault(Activation activation,
int ix)
Workhorse for modifying the default value of a column. |
private void |
modifyColumnType(Activation activation,
int ix)
|
boolean |
needsRowLocation()
needsRowLocation returns true iff this the row source expects the drainer of the row source to call rowLocation after getting a row from getNextRowFromRowSource. |
boolean |
needsToClone()
Does the caller of getNextRowFromRowSource() need to clone the row in order to keep a reference to the row past the getNextRowFromRowSource() call which returned the row. |
private void |
objectifyStreamingColumns()
|
private void |
openBulkFetchScan(long heapConglomNumber)
|
void |
rowLocation(RowLocation rl)
rowLocation is a callback for the drainer of the row source to return the rowLocation of the current row, i.e, the row that is being returned by getNextRowFromRowSource. |
private void |
setUpAllSorts(ExecRow sourceRow,
RowLocation rl)
Set up to update all of the indexes on a table when doing a bulk insert on an empty table. |
java.lang.String |
toString()
|
private void |
truncateTable(Activation activation)
|
private void |
updateAllIndexes(long newHeapConglom,
DataDictionary dd)
Update all of the indexes on a table when doing a bulk insert on an empty table. |
private void |
updateIndex(long newHeapConglom,
DataDictionary dd,
int index,
long[] newIndexCongloms)
|
private void |
updateNewAutoincrementColumn(Activation activation,
java.lang.String columnName,
long initial,
long increment)
Update values in a new autoincrement column being added to a table. |
private void |
updateNewColumnToDefault(Activation activation,
java.lang.String columnName,
java.lang.String defaultText,
LanguageConnectionContext lcc)
Update a new column with its default. |
private boolean |
validateNotNullConstraint(java.lang.String[] columnNames,
boolean[] nullCols,
int numRows,
LanguageConnectionContext lcc,
java.lang.String errorMsg)
Make sure that the columns are non null If any column is nullable, check that the data is null. |
Methods inherited from class org.apache.derby.impl.sql.execute.DDLConstantAction |
constructToString, getAndCheckSchemaDescriptor, getSchemaDescriptorForCreate, lockTableForDDL, readExternal, upToDate, writeExternal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected SchemaDescriptor sd
protected java.lang.String tableName
protected UUID schemaId
protected int tableType
protected long tableConglomerateId
protected ColumnInfo[] columnInfo
protected ConstraintConstantAction[] constraintActions
protected char lockGranularity
private boolean compressTable
private boolean sequential
private int behavior
private boolean doneScan
private boolean[] needToDropSort
private boolean[] validRow
private int bulkFetchSize
private int currentCompressRow
private int numIndexes
private int rowCount
private long estimatedRowCount
private long[] indexConglomerateNumbers
private long[] sortIds
private FormatableBitSet indexedCols
private ConglomerateController compressHeapCC
private ExecIndexRow[] indexRows
private ExecRow[] baseRow
private ExecRow currentRow
private GroupFetchScanController compressHeapGSC
private IndexRowGenerator[] compressIRGs
private DataValueDescriptor[][] baseRowArray
private RowLocation[] compressRL
private SortController[] sorters
private int columnPosition
private ColumnOrdering[][] ordering
private TableDescriptor td
private boolean truncateTable
private LanguageConnectionContext lcc
private DataDictionary dd
private DependencyManager dm
private TransactionController tc
private Activation activation
protected UUID tableId
Constructor Detail |
AlterTableConstantAction(SchemaDescriptor sd, java.lang.String tableName, UUID tableId, long tableConglomerateId, int tableType, ColumnInfo[] columnInfo, ConstraintConstantAction[] constraintActions, char lockGranularity, boolean compressTable, int behavior, boolean sequential, boolean truncateTable)
sd
- descriptor for the schema that table lives in.tableName
- Name of table.tableId
- UUID of tabletableConglomerateId
- heap conglomerate number of tabletableType
- Type of table (e.g., BASE).columnInfo
- Information on all the columns in the table.constraintActions
- ConstraintConstantAction[] for constraintslockGranularity
- The lock granularity.compressTable
- Whether or not this is a compress tablebehavior
- drop behavior for dropping columnsequential
- If compress table/drop column, whether or not sequentialtruncateTable
- Whether or not this is a truncate tableMethod Detail |
public java.lang.String toString()
public void executeConstantAction(Activation activation) throws StandardException
executeConstantAction
in interface ConstantAction
activation
- The execution environment for this constant action.
StandardException
- Thrown on failureConstantAction.executeConstantAction(org.apache.derby.iapi.sql.Activation)
public void execGuts(Activation activation) throws StandardException
StandardException
- Thrown on failureprivate void addNewColumnToTable(Activation activation, int ix) throws StandardException
ix
- the index of the column specfication in the ALTER
statement-- currently we allow only one.
StandardException
- thrown on failure.private void dropColumnFromTable(Activation activation, int ix) throws StandardException
ix
- the index of the column specfication in the ALTER
statement-- currently we allow only one.
StandardException
- thrown on failure.private void modifyColumnType(Activation activation, int ix) throws StandardException
StandardException
private void modifyColumnConstraint(Activation activation, java.lang.String colName, boolean nullability) throws StandardException
StandardException
private void modifyColumnDefault(Activation activation, int ix) throws StandardException
activation
- activationix
- the index of the column specfication in the ALTER
statement-- currently we allow only one.
StandardException,
- thrown on error.
StandardException
private void compressTable(Activation activation) throws StandardException
StandardException
private void truncateTable(Activation activation) throws StandardException
StandardException
private void updateAllIndexes(long newHeapConglom, DataDictionary dd) throws StandardException
StandardException
- thrown on errorprivate void updateIndex(long newHeapConglom, DataDictionary dd, int index, long[] newIndexCongloms) throws StandardException
StandardException
private void getAffectedIndexes(Activation activation) throws StandardException
StandardException
- Thrown on errorprivate void setUpAllSorts(ExecRow sourceRow, RowLocation rl) throws StandardException
StandardException
- thrown on errorpublic FormatableBitSet getValidColumns()
RowSource
getValidColumns
in interface RowSource
RowSource.getValidColumns()
public DataValueDescriptor[] getNextRowFromRowSource() throws StandardException
RowSource
A null column can be specified by leaving the object null, or indicated by returning a non-null getValidColumns. On streaming columns, it can be indicated by returning a non-null get FieldStates.
If RowSource.needToClone() is true then the returned row (the DataValueDescriptor[]) is guaranteed not to be modified by drainer of the RowSource (except that the input stream will be read, of course) and drainer will keep no reference to it before making the subsequent nextRow call. So it is safe to return the same DataValueDescriptor[] in subsequent nextRow calls if that is desirable for performance reasons.
If RowSource.needToClone() is false then the returned row (the DataValueDescriptor[]) may be be modified by drainer of the RowSource, and the drainer may keep a reference to it after making the subsequent nextRow call. In this case the client should severe all references to the row after returning it from getNextRowFromRowSource().
getNextRowFromRowSource
in interface RowSource
StandardException
- on errorRowSource.getNextRowFromRowSource()
public boolean needsToClone()
RowSource
needsToClone
in interface RowSource
RowSource.needsToClone()
public void closeRowSource()
RowSource
closeRowSource
in interface RowSource
RowSource.closeRowSource()
public boolean needsRowLocation()
RowLocationRetRowSource
needsRowLocation
in interface RowLocationRetRowSource
RowLocationRetRowSource.needsRowLocation()
public void rowLocation(RowLocation rl) throws StandardException
RowLocationRetRowSource
boolean needsRL = rowSource.needsRowLocation(); DataValueDescriptor[] row; while((row = rowSource.getNextRowFromRowSource()) != null) { RowLocation rl = heapConglomerate.insertRow(row); if (needsRL) rowSource.rowLocation(rl); }
rowLocation
in interface RowLocationRetRowSource
StandardException
- on errorRowLocationRetRowSource.rowLocation(org.apache.derby.iapi.types.RowLocation)
private void objectifyStreamingColumns() throws StandardException
StandardException
private void insertIntoSorter(int index, RowLocation rl) throws StandardException
StandardException
public void cleanUp() throws StandardException
StandardException
- Thrown on errorResultSet.cleanUp()
private int getSemiRowCount(TransactionController tc) throws StandardException
StandardException
- Thrown on failureprivate void updateNewColumnToDefault(Activation activation, java.lang.String columnName, java.lang.String defaultText, LanguageConnectionContext lcc) throws StandardException
columnName
- column namedefaultText
- default textlcc
- the language connection context
StandardException
- if update to default failsprivate static void executeUpdate(LanguageConnectionContext lcc, java.lang.String updateStmt) throws StandardException
StandardException
private long getColumnMax(Activation activation, TableDescriptor td, java.lang.String columnName, long increment, long initial) throws StandardException
StandardException
private void dropAllColumnDefaults(UUID tableId, DataDictionary dd) throws StandardException
StandardException
private void openBulkFetchScan(long heapConglomNumber) throws StandardException
StandardException
private void closeBulkFetchScan() throws StandardException
StandardException
private void updateNewAutoincrementColumn(Activation activation, java.lang.String columnName, long initial, long increment) throws StandardException
columnName
- autoincrement column name that is being added.initial
- initial value of the autoincrement column.increment
- increment value of the autoincrement column.
StandardException
updateNewColumnToDefault(org.apache.derby.iapi.sql.Activation, java.lang.String, java.lang.String, org.apache.derby.iapi.sql.conn.LanguageConnectionContext)
private boolean validateNotNullConstraint(java.lang.String[] columnNames, boolean[] nullCols, int numRows, LanguageConnectionContext lcc, java.lang.String errorMsg) throws StandardException
columnNames
- names of columns to be checkednullCols
- true if corresponding column is nullablenumRows
- number of rows in the tablelcc
- language contexterrorMsg
- error message to use for exception
StandardException
- on errorprivate java.lang.Object[] compressIndexArrays(long[] indexCIDS, IndexRowGenerator[] irgs)
indexCIDS
- array of index conglomerate numbersirgs
- array of index row generaters
public boolean modifiesTableId(UUID tableId)
modifiesTableId
in interface ConstantAction
modifiesTableId
in class DDLConstantAction
tableId
- the table id
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |