Package org.h2.command.ddl
Class CommandWithColumns
java.lang.Object
org.h2.command.Prepared
org.h2.command.ddl.DefineCommand
org.h2.command.ddl.SchemaCommand
org.h2.command.ddl.CommandWithColumns
- Direct Known Subclasses:
AlterTableAlterColumn
,CreateTable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ArrayList
<DefineCommand> private AlterTableAddConstraint
Fields inherited from class org.h2.command.ddl.DefineCommand
transactional
Fields inherited from class org.h2.command.Prepared
create, parameters, prepareAlways, session, sqlStatement, sqlTokens
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Add a column to this table.void
addConstraintCommand
(DefineCommand command) Add a constraint statement to this statement.protected void
changePrimaryKeysToNotNull
(ArrayList<Column> columns) For the given list of columns, disable "nullable" for those columns that are primary key columns.protected void
Create the constraints.generateSequences
(ArrayList<Column> columns, boolean temporary) For the given list of columns, create sequences for identity columns (if needed), and then get the list of all sequences of the columns.private ArrayList
<DefineCommand> private boolean
setPrimaryKey
(AlterTableAddConstraint primaryKey) Set the primary key, but also check if a primary key with different columns is already defined.Methods inherited from class org.h2.command.ddl.SchemaCommand
getSchema
Methods inherited from class org.h2.command.ddl.DefineCommand
isReadOnly, isTransactional, queryMeta, setTransactional
Methods inherited from class org.h2.command.Prepared
checkCanceled, checkParameters, collectDependencies, getCteCleanups, getCurrentRowNumber, getObjectId, getParameters, getPersistedObjectId, getPlanSQL, getSession, getSimpleSQL, getSQL, getSQLTokens, getType, isCacheable, isQuery, needRecompile, prepare, query, setCommand, setCteCleanups, setCurrentRowNumber, setParameterList, setPersistedObjectId, setPrepareAlways, setRow, setSession, setSQL, toString, update
-
Field Details
-
constraintCommands
-
-
-
Constructor Details
-
CommandWithColumns
-
-
Method Details
-
addColumn
Add a column to this table.- Parameters:
column
- the column to add
-
addConstraintCommand
Add a constraint statement to this statement. The primary key definition is one possible constraint statement.- Parameters:
command
- the statement to add
-
changePrimaryKeysToNotNull
For the given list of columns, disable "nullable" for those columns that are primary key columns.- Parameters:
columns
- the list of columns
-
createConstraints
protected void createConstraints()Create the constraints. -
generateSequences
For the given list of columns, create sequences for identity columns (if needed), and then get the list of all sequences of the columns.- Parameters:
columns
- the columnstemporary
- whether generated sequences should be temporary- Returns:
- the list of sequences (may be empty)
-
getConstraintCommands
-
setPrimaryKey
Set the primary key, but also check if a primary key with different columns is already defined.If an unnamed primary key with the same columns is already defined it is removed from the list of constraints and this method returns
false
.- Parameters:
primaryKey
- the primary key- Returns:
- whether another primary key with the same columns was already set and the specified primary key should be ignored
-
getPrimaryKey
-