public class TableElementList extends QueryTreeNodeVector
| Modifier and Type | Field and Description |
|---|---|
private int |
numColumns |
private TableDescriptor |
td |
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX| Constructor and Description |
|---|
TableElementList() |
| Modifier and Type | Method and Description |
|---|---|
void |
addTableElement(TableElementNode tableElement)
Add a TableElementNode to this TableElementList
|
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 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 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) |
boolean |
containsColumnName(java.lang.String colName)
Determine whether or not the parameter matches a column name in this
list.
|
int |
countConstraints(int constraintType)
Count the number of constraints of the specified type.
|
int |
countGenerationClauses()
Count the number of generation clauses.
|
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.
|
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,
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.
|
acceptChildren, addElement, destructiveAppend, elementAt, indexOf, insertElementAt, nondestructiveAppend, printSubNodes, remove, removeAllElements, removeElement, removeElementAt, setElementAt, sizeaccept, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, toString, treePrint, treePrint, verifyClassExistprivate int numColumns
private TableDescriptor td
public void addTableElement(TableElementNode tableElement)
tableElement - The TableElementNode to add to this listvoid setCollationTypesOnCharacterStringColumns(SchemaDescriptor sd) throws StandardException
sd - StandardExceptionvoid setCollationTypeOnCharacterStringColumn(SchemaDescriptor sd, ColumnDefinitionNode cdn) throws StandardException
sd - StandardExceptionvoid 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
StandardExceptionpublic int countConstraints(int constraintType)
constraintType - The constraint type to search for.public int countGenerationClauses()
public int countNumberOfColumns()
public int genColumnInfos(ColumnInfo[] colInfos) throws StandardException
colInfos - The ColumnInfo[] to be filled in.StandardExceptionpublic 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, 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.indexName - 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 - StandardExceptionprivate java.util.Properties checkIndexPageSizeProperty(ConstraintDefinitionNode cdn) throws StandardException
cdn - Constraint nodeStandardExceptionprivate void checkForDuplicateColumns(DDLStatementNode ddlStmt, java.util.Set 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 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
StandardExceptionprivate DataTypeDescriptor getColumnDataTypeDescriptor(java.lang.String colName)
private DataTypeDescriptor getColumnDataTypeDescriptor(java.lang.String colName, TableDescriptor td)
private ColumnDefinitionNode findColumnDefinition(java.lang.String colName)
colName - public boolean containsColumnName(java.lang.String colName)
colName - The column name to search for.Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.