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 Modifier and Type Field Description private QueryasQueryprivate java.lang.Stringcommentprivate CreateTableDatadataprivate booleanifNotExistsprivate booleanonCommitDropprivate booleanonCommitTruncateprivate booleanwithNoData-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColumn(Column column)Add a column to this table.private voidgenerateColumnsFromQuery()java.util.ArrayList<Column>getColumns()intgetType()Get the command type as defined in CommandInterfacevoidsetComment(java.lang.String comment)voidsetGlobalTemporary(boolean globalTemporary)voidsetHidden(boolean isHidden)voidsetIfNotExists(boolean ifNotExists)voidsetOnCommitDrop()This temporary table is dropped on commit.voidsetOnCommitTruncate()This temporary table is truncated on commit.voidsetPersistData(boolean persistData)voidsetPersistIndexes(boolean persistIndexes)voidsetQuery(Query query)voidsetTableEngine(java.lang.String tableEngine)voidsetTableEngineParams(java.util.ArrayList<java.lang.String> tableEngineParams)voidsetTableName(java.lang.String tableName)voidsetTemporary(boolean temporary)voidsetWithNoData(boolean withNoData)longupdate()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 Detail
-
data
private final CreateTableData data
-
ifNotExists
private boolean ifNotExists
-
onCommitDrop
private boolean onCommitDrop
-
onCommitTruncate
private boolean onCommitTruncate
-
asQuery
private Query asQuery
-
comment
private java.lang.String comment
-
withNoData
private boolean withNoData
-
-
Constructor Detail
-
CreateTable
public CreateTable(SessionLocal session, Schema schema)
-
-
Method Detail
-
setQuery
public void setQuery(Query query)
-
setTemporary
public void setTemporary(boolean temporary)
-
setTableName
public void setTableName(java.lang.String tableName)
-
addColumn
public void addColumn(Column column)
Description copied from class:CommandWithColumnsAdd a column to this table.- Specified by:
addColumnin classCommandWithColumns- Parameters:
column- the column to add
-
getColumns
public java.util.ArrayList<Column> getColumns()
-
setIfNotExists
public void setIfNotExists(boolean ifNotExists)
-
update
public long update()
Description copied from class:PreparedExecute the statement.
-
generateColumnsFromQuery
private void generateColumnsFromQuery()
-
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(java.lang.String comment)
-
setPersistData
public void setPersistData(boolean persistData)
-
setWithNoData
public void setWithNoData(boolean withNoData)
-
setTableEngine
public void setTableEngine(java.lang.String tableEngine)
-
setTableEngineParams
public void setTableEngineParams(java.util.ArrayList<java.lang.String> tableEngineParams)
-
setHidden
public void setHidden(boolean isHidden)
-
-