org.h2.command.ddl
Class CreateTable

java.lang.Object
  extended by org.h2.command.Prepared
      extended by org.h2.command.ddl.DefineCommand
          extended by org.h2.command.ddl.SchemaCommand
              extended by org.h2.command.ddl.CreateTable

public class CreateTable
extends SchemaCommand

This class represents the statement CREATE TABLE


Field Summary
 
Fields inherited from class org.h2.command.Prepared
headPos, parameters, prepareAlways, session, sqlStatement
 
Constructor Summary
CreateTable(Session session, Schema schema)
           
 
Method Summary
 void addColumn(Column column)
          Add a column to this table.
 void addConstraintCommand(Prepared command)
          Add a constraint statement to this statement.
 void setComment(java.lang.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 setTableName(java.lang.String tableName)
           
 void setTemporary(boolean temporary)
           
 int update()
          Execute the statement.
 
Methods inherited from class org.h2.command.ddl.SchemaCommand
getSchema
 
Methods inherited from class org.h2.command.ddl.DefineCommand
isReadOnly, isTransactional, queryMeta
 
Methods inherited from class org.h2.command.Prepared
checkCanceled, checkParameters, getCurrentObjectId, getCurrentRowNumber, getObjectId, getParameters, getPlanSQL, getSQL, getSQL, getSQL, isQuery, needRecompile, prepare, query, setCommand, setCurrentRowNumber, setHeadPos, setObjectId, setParameterList, setPrepareAlways, setRow, setSession, setSQL, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CreateTable

public CreateTable(Session 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)
Add a column to this table.

Parameters:
column - the column to add

addConstraintCommand

public void addConstraintCommand(Prepared command)
                          throws java.sql.SQLException
Add a constraint statement to this statement. The primary key definition is one possible constraint statement.

Parameters:
command - the statement to add
Throws:
java.sql.SQLException

setIfNotExists

public void setIfNotExists(boolean ifNotExists)

update

public int update()
           throws java.sql.SQLException
Description copied from class: Prepared
Execute the statement.

Overrides:
update in class Prepared
Returns:
the update count
Throws:
java.sql.SQLException - if it is a query

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)