Package org.h2.command.ddl

# Class AlterTableAddConstraint

java.lang.Object
org.h2.command.Prepared
org.h2.command.ddl.DefineCommand
org.h2.command.ddl.SchemaCommand
org.h2.command.ddl.AlterTable
org.h2.command.ddl.AlterTableAddConstraint

public class AlterTableAddConstraint extends AlterTable
This class represents the statement ALTER TABLE ADD CONSTRAINT

## 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
`AlterTableAddConstraint(SessionLocal session, Schema schema, int type, boolean ifNotExists)`

## Method Summary

Modifier and Type
Method
Description
`String`
`getConstraintName()`
`IndexColumn[]`
`getIndexColumns()`
`int`
`getType()`
Get the command type as defined in CommandInterface
`void`
`setCheckExisting(boolean b)`
`void`
`setCheckExpression(Expression expression)`
`void`
`setComment(String comment)`
`void`
`setConstraintName(String constraintName)`
`void`
`setDeleteAction(ConstraintActionType action)`
`void`
`setIndex(Index index)`
`void`
`setIndexColumns(IndexColumn[] indexColumns)`
`void`
`setNullsDistinct(NullsDistinct nullsDistinct)`
`void`
`setPrimaryKeyHash(boolean b)`
`void`
`setRefIndex(Index refIndex)`
`void`
`setRefIndexColumns(IndexColumn[] indexColumns)`
`void`
`setRefTableName(Schema refSchema, String ref)`
Set the referenced table.
`void`
`setUpdateAction(ConstraintActionType action)`
`long`
`update(Table table)`

### Methods inherited from class org.h2.command.ddl.AlterTable

`setIfTableExists, setTableName, update`

### 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

### AlterTableAddConstraint

public AlterTableAddConstraint(SessionLocal session, Schema schema, int type, boolean ifNotExists)

## Method Details

### update

public long update(Table table)

### setDeleteAction

public void setDeleteAction(ConstraintActionType action)

### setUpdateAction

public void setUpdateAction(ConstraintActionType action)

### setConstraintName

public void setConstraintName(String constraintName)

### getConstraintName

public String getConstraintName()

### 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

### setNullsDistinct

public void setNullsDistinct(NullsDistinct nullsDistinct)

### setCheckExpression

public void setCheckExpression(Expression expression)

### setIndexColumns

public void setIndexColumns(IndexColumn[] indexColumns)

### getIndexColumns

public IndexColumn[] getIndexColumns()

### setRefTableName

public void setRefTableName(Schema refSchema, String ref)
Set the referenced table.

Parameters:
  `refSchema` - the schema
  `ref` - the table name

### setRefIndexColumns

public void setRefIndexColumns(IndexColumn[] indexColumns)

### setIndex

public void setIndex(Index index)

### setRefIndex

public void setRefIndex(Index refIndex)

### setComment

public void setComment(String comment)

### setCheckExisting

public void setCheckExisting(boolean b)

### setPrimaryKeyHash

public void setPrimaryKeyHash(boolean b)