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

public class AlterTableAlterColumn extends CommandWithColumns
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

### 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
Constructor
Description
`AlterTableAlterColumn(SessionLocal session, Schema schema)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addColumn(Column column)`
Add a column to this table.
`int`
`getType()`
Get the command type as defined in CommandInterface
`void`
`setAddAfter(String after)`
`void`
`setAddBefore(String before)`
`void`
`setAddFirst()`
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, isRetryable, isTransactional, queryMeta, setTransactional`

### Methods inherited from class org.h2.command.Prepared

`checkCanceled, checkParameters, collectDependencies, getCurrentRowNumber, getDatabase, getObjectId, getParameters, getPersistedObjectId, getPlanSQL, getPlanSQL, getSession, getSimpleSQL, getSQL, getSQLTokens, isCacheable, isQuery, isWithParamValues, needRecompile, prepare, query, setCommand, setCurrentRowNumber, setParameterList, setPersistedObjectId, setPrepareAlways, setRow, setSession, setSQL, setWithParamValues, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### AlterTableAlterColumn

public AlterTableAlterColumn(SessionLocal session, Schema schema)

## Method Details

### setIfTableExists

public void setIfTableExists(boolean b)

### setTableName

public void setTableName(String tableName)

### setOldColumn

public void setOldColumn(Column oldColumn)

### setAddFirst

public void setAddFirst()
Add the column as the first column of the table.

### setAddBefore

public void setAddBefore(String before)

### setAddAfter

public void setAddAfter(String after)

### update

public long update()
Description copied from class: `Prepared`
Execute the statement.

Overrides:
  `update` in class `Prepared`
Returns:
  the update count

### setType

public void setType(int type)

### setSelectivity

public void setSelectivity(Expression selectivity)

### setDefaultExpression

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

Parameters:
  `defaultExpression` - default or on update expression

### setUsingExpression

public void setUsingExpression(Expression usingExpression)
Set using expression.

Parameters:
  `usingExpression` - using expression

### setNewColumn

public void setNewColumn(Column newColumn)

### getType

public int getType()
Description copied from class: `Prepared`
Get the command type as defined in CommandInterface

Specified by:
  `getType` in class `Prepared`
Returns:
  the statement type

### setIfNotExists

public void setIfNotExists(boolean ifNotExists)

### addColumn

public void addColumn(Column column)
Description copied from class: `CommandWithColumns`
Add a column to this table.

Specified by:
  `addColumn` in class `CommandWithColumns`
Parameters:
  `column` - the column to add

### setColumnsToRemove

public void setColumnsToRemove(ArrayList<Column> columnsToRemove)

### setBooleanFlag

public void setBooleanFlag(boolean booleanFlag)