Top Description Fields Constructors Methods
org.h2.command.ddl

public Class AlterTableAlterColumn

extends CommandWithColumns
Class Inheritance
Imports
java.util.ArrayList, .HashSet, org.h2.api.ErrorCode, org.h2.command.CommandContainer, .CommandInterface, .Parser, .ParserBase, .Prepared, org.h2.constraint.Constraint, .ConstraintReferential, .ConstraintUnique, org.h2.engine.Constants, .Database, .DbObject, .Right, .SessionLocal, org.h2.expression.Expression, .ExpressionVisitor, org.h2.index.Index, .IndexType, org.h2.message.DbException, org.h2.result.ResultInterface, .SearchRow, org.h2.schema.Schema, .SchemaObject, .Sequence, .TriggerObject, org.h2.table.Column, .Table, .TableBase, .TableView, org.h2.util.HasSQL, .Utils

This class represents the statements ALTER TABLE ADD, ALTER TABLE ADD IF NOT EXISTS, ALTER TABLE ALTER COLUMN, ALTER TABLE ALTER COLUMN SELECTIVITY, ALTER TABLE ALTER COLUMN SET DEFAULT, ALTER TABLE ALTER COLUMN DROP DEFAULT, ALTER TABLE ALTER COLUMN DROP EXPRESSION, ALTER TABLE ALTER COLUMN SET NULL, ALTER TABLE ALTER COLUMN DROP NULL, ALTER TABLE ALTER COLUMN SET VISIBLE, ALTER TABLE ALTER COLUMN SET INVISIBLE, ALTER TABLE DROP COLUMN

Field Summary

Modifier and TypeField and Description
private String
private String
private boolean
private boolean
private ArrayList<Column>
private ArrayList<Column>
private Expression
defaultExpression

Default or on update expression.

private boolean
private boolean
private Column
private Expression
private Column
private String
private int
private Expression

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static StringBuilder
addColumn(Column column, StringBuilder columnNames, StringBuilder columnValues)

public void
addColumn(Column
the column to add
column
)

Implements abstract org.h2.command.ddl.CommandWithColumns.addColumn.

Add a column to this table.

private void
private static void
checkDefaultReferencesTable(Table table, Expression defaultExpression)

private void
private void
private void
checkViews(SchemaObject sourceTable, SchemaObject newTable)

Check that all views and other dependent objects.

private void
checkViewsAreValid(DbObject
the table or view to check
tableOrView
)

Check that a table or view is still valid.

private Table
cloneTableStructure(Table table, Column[] columns, Database db, String tempName, ArrayList<Column> newColumns)

private void
convertIdentityColumn(Table table, Column oldColumn, Column newColumn)

private void
copyData(Table table, ArrayList<Sequence> sequences, boolean createConstraints)

private void
public int
getType()

Implements abstract org.h2.command.Prepared.getType.

Get the command type as defined in CommandInterface

private void
removeSequence(Table table, Sequence sequence)

public void
public void
public void
setAddFirst()

Add the column as the first column of the table.

public void
setBooleanFlag(boolean booleanFlag)

public void
public void
setDefaultExpression(Expression
default or on update expression
defaultExpression
)

Set default or on update expression.

public void
setIfNotExists(boolean ifNotExists)

public void
setIfTableExists(boolean b)

public void
setNewColumn(Column newColumn)

public void
setOldColumn(Column oldColumn)

public void
public void
setTableName(String tableName)

public void
setType(int type)

public void
setUsingExpression(Expression
using expression
usingExpression
)

Set using expression.

public long
update()

Overrides org.h2.command.Prepared.update.

Execute the statement.

Inherited from org.h2.command.ddl.CommandWithColumns:
addConstraintCommandchangePrimaryKeysToNotNullcreateConstraintsgenerateSequencesgetPrimaryKey

Field Detail

addAfterback to summary
private String addAfter
addBeforeback to summary
private String addBefore
addFirstback to summary
private boolean addFirst
booleanFlagback to summary
private boolean booleanFlag
columnsToAddback to summary
private ArrayList<Column> columnsToAdd
columnsToRemoveback to summary
private ArrayList<Column> columnsToRemove
defaultExpressionback to summary
private Expression defaultExpression

Default or on update expression.

ifNotExistsback to summary
private boolean ifNotExists
ifTableExistsback to summary
private boolean ifTableExists
newColumnback to summary
private Column newColumn
newSelectivityback to summary
private Expression newSelectivity
oldColumnback to summary
private Column oldColumn
tableNameback to summary
private String tableName
typeback to summary
private int type
usingExpressionback to summary
private Expression usingExpression

Constructor Detail

AlterTableAlterColumnback to summary
public AlterTableAlterColumn(SessionLocal session, Schema schema)

Method Detail

addColumnback to summary
private static StringBuilder addColumn(Column column, StringBuilder columnNames, StringBuilder columnValues)
addColumnback to summary
public void addColumn(Column column)

Implements abstract org.h2.command.ddl.CommandWithColumns.addColumn.

Doc from org.h2.command.ddl.CommandWithColumns.addColumn.

Add a column to this table.

Parameters
column:Column

the column to add

Annotations
@Override
checkClusteringback to summary
private void checkClustering(Column c)
checkDefaultReferencesTableback to summary
private static void checkDefaultReferencesTable(Table table, Expression defaultExpression)
checkNoNullValuesback to summary
private void checkNoNullValues(Table table)
checkNullableback to summary
private void checkNullable(Table table)
checkViewsback to summary
private void checkViews(SchemaObject sourceTable, SchemaObject newTable)

Check that all views and other dependent objects.

checkViewsAreValidback to summary
private void checkViewsAreValid(DbObject tableOrView)

Check that a table or view is still valid.

Parameters
tableOrView:DbObject

the table or view to check

cloneTableStructureback to summary
private Table cloneTableStructure(Table table, Column[] columns, Database db, String tempName, ArrayList<Column> newColumns)
convertIdentityColumnback to summary
private void convertIdentityColumn(Table table, Column oldColumn, Column newColumn)
copyDataback to summary
private void copyData(Table table, ArrayList<Sequence> sequences, boolean createConstraints)
executeback to summary
private void execute(String sql)
getTypeback to summary
public int getType()

Implements abstract org.h2.command.Prepared.getType.

Doc from org.h2.command.Prepared.getType.

Get the command type as defined in CommandInterface

Returns:int

the statement type

Annotations
@Override
removeSequenceback to summary
private void removeSequence(Table table, Sequence sequence)
setAddAfterback to summary
public void setAddAfter(String after)
setAddBeforeback to summary
public void setAddBefore(String before)
setAddFirstback to summary
public void setAddFirst()

Add the column as the first column of the table.

setBooleanFlagback to summary
public void setBooleanFlag(boolean booleanFlag)
setColumnsToRemoveback to summary
public void setColumnsToRemove(ArrayList<Column> columnsToRemove)
setDefaultExpressionback to summary
public void setDefaultExpression(Expression defaultExpression)

Set default or on update expression.

Parameters
defaultExpression:Expression

default or on update expression

setIfNotExistsback to summary
public void setIfNotExists(boolean ifNotExists)
setIfTableExistsback to summary
public void setIfTableExists(boolean b)
setNewColumnback to summary
public void setNewColumn(Column newColumn)
setOldColumnback to summary
public void setOldColumn(Column oldColumn)
setSelectivityback to summary
public void setSelectivity(Expression selectivity)
setTableNameback to summary
public void setTableName(String tableName)
setTypeback to summary
public void setType(int type)
setUsingExpressionback to summary
public void setUsingExpression(Expression usingExpression)

Set using expression.

Parameters
usingExpression:Expression

using expression

updateback to summary
public long update()

Overrides org.h2.command.Prepared.update.

Doc from org.h2.command.Prepared.update.

Execute the statement.

Returns:long

the update count

Annotations
@Override