Package org.h2.command.ddl
Class AlterTableAlterColumn
java.lang.Object
org.h2.command.Prepared
org.h2.command.ddl.DefineCommand
org.h2.command.ddl.SchemaCommand
org.h2.command.ddl.CommandWithColumns
org.h2.command.ddl.AlterTableAlterColumn
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
FieldsModifier and TypeFieldDescriptionprivate String
private String
private boolean
private boolean
private Expression
Default or on update expression.private boolean
private boolean
private Column
private Expression
private Column
private String
private int
private Expression
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 TypeMethodDescriptionvoid
Add a column to this table.private static StringBuilder
addColumn
(Column column, StringBuilder columnNames, StringBuilder columnValues) private void
private static void
checkDefaultReferencesTable
(Table table, Expression defaultExpression) private void
checkNoNullValues
(Table table) private void
checkNullable
(Table table) private void
checkViews
(SchemaObject sourceTable, SchemaObject newTable) Check that all views and other dependent objects.private void
checkViewsAreValid
(DbObject 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 c) private void
private void
int
getType()
Get the command type as defined in CommandInterfaceprivate void
removeSequence
(Table table, Sequence sequence) void
setAddAfter
(String after) void
setAddBefore
(String before) void
Add the column as the first column of the table.void
setBooleanFlag
(boolean booleanFlag) void
setColumnsToRemove
(ArrayList<Column> columnsToRemove) void
setDefaultExpression
(Expression defaultExpression) Set default or on update expression.void
setIfNotExists
(boolean ifNotExists) void
setIfTableExists
(boolean b) void
setNewColumn
(Column newColumn) void
setOldColumn
(Column oldColumn) void
setSelectivity
(Expression selectivity) void
setTableName
(String tableName) void
setType
(int type) void
setUsingExpression
(Expression usingExpression) Set using expression.long
update()
Execute the statement.Methods inherited from class org.h2.command.ddl.CommandWithColumns
addConstraintCommand, changePrimaryKeysToNotNull, createConstraints, generateSequences, getPrimaryKey
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, isCacheable, isQuery, needRecompile, prepare, query, setCommand, setCteCleanups, setCurrentRowNumber, setParameterList, setPersistedObjectId, setPrepareAlways, setRow, setSession, setSQL, toString
-
Field Details
-
tableName
-
oldColumn
-
newColumn
-
type
private int type -
defaultExpression
Default or on update expression. -
newSelectivity
-
usingExpression
-
addFirst
private boolean addFirst -
addBefore
-
addAfter
-
ifTableExists
private boolean ifTableExists -
ifNotExists
private boolean ifNotExists -
columnsToAdd
-
columnsToRemove
-
booleanFlag
private boolean booleanFlag
-
-
Constructor Details
-
AlterTableAlterColumn
-
-
Method Details
-
setIfTableExists
public void setIfTableExists(boolean b) -
setTableName
-
setOldColumn
-
setAddFirst
public void setAddFirst()Add the column as the first column of the table. -
setAddBefore
-
setAddAfter
-
update
public long update()Description copied from class:Prepared
Execute the statement. -
checkDefaultReferencesTable
-
checkClustering
-
convertIdentityColumn
-
removeSequence
-
copyData
-
cloneTableStructure
-
addColumn
private static StringBuilder addColumn(Column column, StringBuilder columnNames, StringBuilder columnValues) -
checkViews
Check that all views and other dependent objects. -
checkViewsAreValid
Check that a table or view is still valid.- Parameters:
tableOrView
- the table or view to check
-
execute
-
checkNullable
-
checkNoNullValues
-
setType
public void setType(int type) -
setSelectivity
-
setDefaultExpression
Set default or on update expression.- Parameters:
defaultExpression
- default or on update expression
-
setUsingExpression
Set using expression.- Parameters:
usingExpression
- using expression
-
setNewColumn
-
getType
public int getType()Description copied from class:Prepared
Get the command type as defined in CommandInterface -
setIfNotExists
public void setIfNotExists(boolean ifNotExists) -
addColumn
Description copied from class:CommandWithColumns
Add a column to this table.- Specified by:
addColumn
in classCommandWithColumns
- Parameters:
column
- the column to add
-
setColumnsToRemove
-
setBooleanFlag
public void setBooleanFlag(boolean booleanFlag)
-