|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.QueryTreeNodeVector
org.apache.derby.impl.sql.compile.TableElementList
public class TableElementList
A TableElementList represents the list of columns and other table elements such as constraints in a CREATE TABLE or ALTER TABLE statement.
Field Summary | |
---|---|
private int |
numColumns
|
private TableDescriptor |
td
|
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
---|
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, isPrivilegeCollectionRequired |
Constructor Summary | |
---|---|
TableElementList()
|
Method Summary | |
---|---|
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.Hashtable ht,
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.Hashtable ht,
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. |
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNodeVector |
---|
acceptChildren, addElement, destructiveAppend, elementAt, indexOf, insertElementAt, nondestructiveAppend, printSubNodes, remove, removeAllElements, removeElement, removeElementAt, setElementAt, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int numColumns
private TableDescriptor td
Constructor Detail |
---|
public TableElementList()
Method Detail |
---|
public 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
public 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.
StandardException
public 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 DataDictionary
StandardException
- 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
-
StandardException
private java.util.Properties checkIndexPageSizeProperty(ConstraintDefinitionNode cdn) throws StandardException
cdn
- Constraint node
StandardException
private void checkForDuplicateColumns(DDLStatementNode ddlStmt, java.util.Hashtable ht, java.lang.String colName) throws StandardException
ddlStmt
- DDLStatementNode which contains this listht
- Hashtable for enforcing uniqueness.colName
- Column name to check for.
StandardException
- Thrown on errorprivate void checkForDuplicateConstraintNames(DDLStatementNode ddlStmt, java.util.Hashtable ht, java.lang.String constraintName) throws StandardException
ddlStmt
- DDLStatementNode which contains this list
StandardException
- Thrown on errorprivate void verifyUniqueColumnList(DDLStatementNode ddlStmt, ConstraintDefinitionNode cdn) throws StandardException
ddlStmt
- The outer DDLStatementNodecdn
- The ConstraintDefinitionNode
StandardException
- 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 table
private 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
-
public boolean containsColumnName(java.lang.String colName)
colName
- The column name to search for.
|
Built on Thu 2010-12-23 20:49:13+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |