Top Fields Constructors Methods
org.h2.command.ddl

public abstract Class CommandWithColumns

extends SchemaCommand
Class Inheritance
Known Direct Subclasses
org.h2.command.ddl.CreateTable, org.h2.command.ddl.AlterTableAlterColumn
Imports
java.util.ArrayList, org.h2.api.ErrorCode, org.h2.command.CommandInterface, org.h2.engine.Constants, .SessionLocal, org.h2.message.DbException, org.h2.schema.Schema, .Sequence, org.h2.table.Column, .IndexColumn

Field Summary

Modifier and TypeField and Description
private ArrayList<DefineCommand>
private AlterTableAddConstraint

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public abstract void
addColumn(Column
the column to add
column
)

Add a column to this table.

public void
addConstraintCommand(DefineCommand
the statement to add
command
)

Add a constraint statement to this statement.

protected void
changePrimaryKeysToNotNull(ArrayList<Column>
the list of columns
columns
)

For the given list of columns, disable "nullable" for those columns that are primary key columns.

protected void
createConstraints()

Create the constraints.

protected ArrayList<Sequence>

Returns:

the list of sequences (may be empty)
generateSequences
(ArrayList<Column>
the columns
columns
,
boolean
whether generated sequences should be temporary
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>
public AlterTableAddConstraint
private boolean

Returns:

whether another primary key with the same columns was already set and the specified primary key should be ignored
setPrimaryKey
(AlterTableAddConstraint
the primary key
primaryKey
)

Set the primary key, but also check if a primary key with different columns is already defined.

Inherited from org.h2.command.ddl.SchemaCommand:
getSchema

Field Detail

constraintCommandsback to summary
private ArrayList<DefineCommand> constraintCommands
primaryKeyback to summary
private AlterTableAddConstraint primaryKey

Constructor Detail

CommandWithColumnsback to summary
protected CommandWithColumns(SessionLocal session, Schema schema)

Method Detail

addColumnback to summary
public abstract void addColumn(Column column)

Add a column to this table.

Parameters
column:Column

the column to add

addConstraintCommandback to summary
public void addConstraintCommand(DefineCommand command)

Add a constraint statement to this statement. The primary key definition is one possible constraint statement.

Parameters
command:DefineCommand

the statement to add

changePrimaryKeysToNotNullback to summary
protected void changePrimaryKeysToNotNull(ArrayList<Column> columns)

For the given list of columns, disable "nullable" for those columns that are primary key columns.

Parameters
columns:ArrayList<Column>

the list of columns

createConstraintsback to summary
protected void createConstraints()

Create the constraints.

generateSequencesback to summary
protected ArrayList<Sequence> 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.

Parameters
columns:ArrayList<Column>

the columns

temporary:boolean

whether generated sequences should be temporary

Returns:ArrayList<Sequence>

the list of sequences (may be empty)

getConstraintCommandsback to summary
private ArrayList<DefineCommand> getConstraintCommands()
getPrimaryKeyback to summary
public AlterTableAddConstraint getPrimaryKey()
setPrimaryKeyback to summary
private boolean setPrimaryKey(AlterTableAddConstraint primaryKey)

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:AlterTableAddConstraint

the primary key

Returns:boolean

whether another primary key with the same columns was already set and the specified primary key should be ignored