Package org.h2.command.ddl

# Class CreateTable

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.CreateTable

public class CreateTable extends CommandWithColumns
This class represents the statement CREATE TABLE

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

## Method Summary

Modifier and Type
Method
Description
`void`
`addColumn(Column column)`
Add a column to this table.
`ArrayList<Column>`
`getColumns()`
`int`
`getType()`
Get the command type as defined in CommandInterface
`void`
`setComment(String comment)`
`void`
`setGlobalTemporary(boolean globalTemporary)`
`void`
`setIfNotExists(boolean ifNotExists)`
`void`
`setOnCommitDrop()`
This temporary table is dropped on commit.
`void`
`setOnCommitTruncate()`
This temporary table is truncated on commit.
`void`
`setPersistData(boolean persistData)`
`void`
`setPersistIndexes(boolean persistIndexes)`
`void`
`setQuery(Query query)`
`void`
`setTableEngine(String tableEngine)`
`void`
`setTableEngineParams(ArrayList<String> tableEngineParams)`
`void`
`setTableName(String tableName)`
`void`
`setTemporary(boolean temporary)`
`void`
`setWithNoData(boolean withNoData)`
`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, invalidateCachedResult, 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

### CreateTable

public CreateTable(SessionLocal session, Schema schema)

## Method Details

### setQuery

public void setQuery(Query query)

### setTemporary

public void setTemporary(boolean temporary)

### setTableName

public void setTableName(String tableName)

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

### getColumns

public ArrayList<Column> getColumns()

### setIfNotExists

public void setIfNotExists(boolean ifNotExists)

### update

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

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

### setPersistIndexes

public void setPersistIndexes(boolean persistIndexes)

### setGlobalTemporary

public void setGlobalTemporary(boolean globalTemporary)

### setOnCommitDrop

public void setOnCommitDrop()
This temporary table is dropped on commit.

### setOnCommitTruncate

public void setOnCommitTruncate()
This temporary table is truncated on commit.

### setComment

public void setComment(String comment)

### setPersistData

public void setPersistData(boolean persistData)

### setWithNoData

public void setWithNoData(boolean withNoData)

### setTableEngine

public void setTableEngine(String tableEngine)

### setTableEngineParams

public void setTableEngineParams(ArrayList<String> tableEngineParams)

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