java.lang.Iterable<TableElementNode>
, Visitable
class TableElementList extends QueryTreeNodeVector<TableElementNode>
Modifier and Type | Field | Description |
---|---|---|
private int |
numColumns |
|
private TableDescriptor |
td |
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
eltClass
Constructor | Description |
---|---|
TableElementList(ContextManager cm) |
Modifier and Type | Method | Description |
---|---|---|
(package private) void |
addTableElement(TableElementNode tableElement) |
Add a TableElementNode to this TableElementList
|
(package private) void |
appendNewColumnsToRCL(FromBaseTable table) |
Append goobered up ResultColumns to the table's RCL.
|
private boolean |
areColumnsNullable(ConstraintDefinitionNode cdn,
TableDescriptor td) |
Checks if any of the columns in the constraint can be null.
|
(package private) void |
bindAndValidateCheckConstraints(FromList fromList) |
Bind and validate all of the check constraints in this list against
the specified FromList.
|
(package private) void |
bindAndValidateGenerationClauses(SchemaDescriptor sd,
FromList fromList,
FormatableBitSet generatedColumns,
TableDescriptor baseTable) |
Bind and validate all of the generation clauses in this list against
the specified FromList.
|
private void |
checkForDuplicateColumns(DDLStatementNode ddlStmt,
java.util.Set<java.lang.String> seenNames,
java.lang.String colName) |
Check to make sure that there are no duplicate column names
in the list.
|
private void |
checkForDuplicateConstraintNames(DDLStatementNode ddlStmt,
java.util.Set<java.lang.String> seenNames,
java.lang.String constraintName) |
Check to make sure that there are no duplicate constraint names
in the list.
|
private void |
checkForNullColumns(ConstraintDefinitionNode cdn,
TableDescriptor td) |
|
private java.util.Properties |
checkIndexPageSizeProperty(ConstraintDefinitionNode cdn) |
Checks if the index should use a larger page size.
|
private boolean |
columnsMatch(java.lang.String[] columnNames1,
java.lang.String[] columnNames2) |
|
(package private) boolean |
containsColumnName(java.lang.String colName) |
Determine whether or not the parameter matches a column name in this
list.
|
(package private) int |
countConstraints(int constraintType) |
Count the number of constraints of the specified type.
|
(package private) int |
countGenerationClauses() |
Count the number of generation clauses.
|
(package private) int |
countNumberOfColumns() |
Count the number of columns.
|
private ColumnDefinitionNode |
findColumnDefinition(java.lang.String colName) |
Find the column definition node in this list that matches
the passed in column name.
|
(package private) void |
findIllegalGenerationReferences(FromList fromList,
TableDescriptor baseTable) |
Complain if a generation clause references other generated columns.
|
(package private) int |
genColumnInfos(ColumnInfo[] colInfos) |
Fill in the ColumnInfo[] for this table element list.
|
(package private) void |
genConstraintActions(boolean forCreateTable,
ConstraintConstantAction[] conActions,
java.lang.String tableName,
SchemaDescriptor tableSd,
DataDictionary dd) |
Fill in the ConstraintConstantAction[] for this create/alter table.
|
private IndexConstantAction |
genIndexAction(boolean forCreateTable,
boolean isUnique,
boolean isUniqueWithDuplicateNulls,
boolean hasDeferrableChecking,
boolean initiallyDeferred,
java.lang.String indexName,
ConstraintDefinitionNode cdn,
java.lang.String[] columnNames,
boolean isConstraint,
SchemaDescriptor sd,
java.lang.String tableName,
int constraintType,
DataDictionary dd) |
utility to generated the call to create the index.
|
private DataTypeDescriptor |
getColumnDataTypeDescriptor(java.lang.String colName) |
|
private DataTypeDescriptor |
getColumnDataTypeDescriptor(java.lang.String colName,
TableDescriptor td) |
|
(package private) void |
setCollationTypeOnCharacterStringColumn(SchemaDescriptor sd,
ColumnDefinitionNode cdn) |
Use the passed schema descriptor's collation type to set the collation
of a character string column.
|
(package private) void |
setCollationTypesOnCharacterStringColumns(SchemaDescriptor sd) |
Use the passed schema descriptor's collation type to set the collation
of the character string types in create table node
|
private void |
setColumnListToNotNull(ConstraintDefinitionNode cdn) |
Set all columns in that appear in a PRIMARY KEY constraint in a CREATE TABLE statement to NOT NULL.
|
(package private) void |
validate(DDLStatementNode ddlStmt,
DataDictionary dd,
TableDescriptor td) |
Validate this TableElementList.
|
(package private) void |
validateForeignKeysOnGenerationClauses(FromList fromList,
FormatableBitSet generatedColumns) |
Prevent foreign keys on generated columns from violating the SQL spec,
part 2, section 11.8 (
|
void |
validatePrimaryKeyNullability() |
Validate nullability of primary keys.
|
private void |
verifyUniqueColumnList(DDLStatementNode ddlStmt,
ConstraintDefinitionNode cdn) |
Verify that a primary/unique table constraint has a valid column list.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isAtomic, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, toString, treePrint, treePrint, verifyClassExist
acceptChildren, addElement, destructiveAppend, elementAt, indexOf, insertElementAt, iterator, nondestructiveAppend, printSubNodes, removeAllElements, removeElement, removeElementAt, setElementAt, size
private int numColumns
private TableDescriptor td
public TableElementList(ContextManager cm)
void addTableElement(TableElementNode tableElement)
tableElement
- The TableElementNode to add to this listvoid setCollationTypesOnCharacterStringColumns(SchemaDescriptor sd) throws StandardException
sd
- StandardException
void setCollationTypeOnCharacterStringColumn(SchemaDescriptor sd, ColumnDefinitionNode cdn) throws StandardException
sd
- StandardException
void validate(DDLStatementNode ddlStmt, DataDictionary dd, TableDescriptor td) throws StandardException
ddlStmt
- DDLStatementNode which contains this listdd
- DataDictionary to usetd
- TableDescriptor for table, if existing table.StandardException
- Thrown on errorpublic void validatePrimaryKeyNullability() throws StandardException
StandardException
int countConstraints(int constraintType)
constraintType
- The constraint type to search for.int countGenerationClauses()
int countNumberOfColumns()
int genColumnInfos(ColumnInfo[] colInfos) throws StandardException
colInfos
- The ColumnInfo[] to be filled in.StandardException
void appendNewColumnsToRCL(FromBaseTable table) throws StandardException
table
- The table in question.StandardException
- Thrown on errorvoid bindAndValidateCheckConstraints(FromList fromList) throws StandardException
fromList
- The FromList in question.StandardException
- Thrown on errorvoid bindAndValidateGenerationClauses(SchemaDescriptor sd, FromList fromList, FormatableBitSet generatedColumns, TableDescriptor baseTable) throws StandardException
sd
- Schema where the table lives.fromList
- The FromList in question.generatedColumns
- Bitmap of generated columns in the table. Vacuous for CREATE TABLE, but may be non-trivial for ALTER TABLE. This routine may set bits for new generated columns.baseTable
- Table descriptor if this is an ALTER TABLE statement.StandardException
- Thrown on errorvoid findIllegalGenerationReferences(FromList fromList, TableDescriptor baseTable) throws StandardException
fromList
- The FromList in question.baseTable
- Table descriptor if this is an ALTER TABLE statement.StandardException
- Thrown on errorvoid validateForeignKeysOnGenerationClauses(FromList fromList, FormatableBitSet generatedColumns) throws StandardException
fromList
- The FromList in question.generatedColumns
- Bitmap of generated columns in the table.StandardException
- Thrown on errorvoid genConstraintActions(boolean forCreateTable, ConstraintConstantAction[] conActions, java.lang.String tableName, SchemaDescriptor tableSd, DataDictionary dd) throws StandardException
forCreateTable
- ConstraintConstantAction is for a create table.conActions
- The ConstraintConstantAction[] to be filled in.tableName
- The name of the Table being created.tableSd
- The schema for that table.dd
- The DataDictionaryStandardException
- Thrown on failureprivate boolean columnsMatch(java.lang.String[] columnNames1, java.lang.String[] columnNames2)
private IndexConstantAction genIndexAction(boolean forCreateTable, boolean isUnique, boolean isUniqueWithDuplicateNulls, boolean hasDeferrableChecking, boolean initiallyDeferred, java.lang.String indexName, ConstraintDefinitionNode cdn, java.lang.String[] columnNames, boolean isConstraint, SchemaDescriptor sd, java.lang.String tableName, int constraintType, DataDictionary dd) throws StandardException
forCreateTable
- Executed as part of a CREATE TABLEisUnique
- True means it will be a unique indexisUniqueWithDuplicateNulls
- True means index check and disallow
any duplicate key if key has no
column with a null value. If any
column in the key has a null value,
no checking is done and insert will
always succeed.hasDeferrableChecking
- True if index is used to back a
deferrable constraintinitiallyDeferred
- True means the deferrable constraint
has deferred modeindexName
- The type of index (BTREE, for
example)cdn
- columnNames
- Names of the columns in the index,
in order.isConstraint
- TRUE if index is backing up a
constraint, else FALSE.sd
- tableName
- Name of table the index will be onconstraintType
- dd
- StandardException
private java.util.Properties checkIndexPageSizeProperty(ConstraintDefinitionNode cdn) throws StandardException
cdn
- Constraint nodeStandardException
private void checkForDuplicateColumns(DDLStatementNode ddlStmt, java.util.Set<java.lang.String> seenNames, java.lang.String colName) throws StandardException
ddlStmt
- DDLStatementNode which contains this listseenNames
- The column names seen so far (for enforcing uniqueness)colName
- Column name to check for.StandardException
- Thrown on errorprivate void checkForDuplicateConstraintNames(DDLStatementNode ddlStmt, java.util.Set<java.lang.String> seenNames, java.lang.String constraintName) throws StandardException
ddlStmt
- DDLStatementNode which contains this listseenNames
- The constraint names seen so far (for enforcing
uniqueness)StandardException
- Thrown on errorprivate void verifyUniqueColumnList(DDLStatementNode ddlStmt, ConstraintDefinitionNode cdn) throws StandardException
ddlStmt
- The outer DDLStatementNodecdn
- The ConstraintDefinitionNodeStandardException
- Thrown if the column list is invalidprivate void setColumnListToNotNull(ConstraintDefinitionNode cdn)
cdn
- The ConstraintDefinitionNode for a PRIMARY KEY constraintprivate boolean areColumnsNullable(ConstraintDefinitionNode cdn, TableDescriptor td)
cdn
- Constraint nodetd
- tabe descriptor of the target tableprivate void checkForNullColumns(ConstraintDefinitionNode cdn, TableDescriptor td) throws StandardException
StandardException
private DataTypeDescriptor getColumnDataTypeDescriptor(java.lang.String colName)
private DataTypeDescriptor getColumnDataTypeDescriptor(java.lang.String colName, TableDescriptor td)
private ColumnDefinitionNode findColumnDefinition(java.lang.String colName)
colName
- boolean containsColumnName(java.lang.String colName)
colName
- The column name to search for.Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.