public class CreateTableQuery extends BaseCreateQuery<CreateTableQuery>
Note that this query supports custom SQL syntax, see CreateTableQuery.Hook
for more
details.
Modifier and Type | Class and Description |
---|---|
static class |
CreateTableQuery.ColumnConstraint
Deprecated.
use
ConstraintClause instead |
static class |
CreateTableQuery.Hook
The HookAnchors supported for CREATE TABLE queries.
|
static class |
CreateTableQuery.TableType
Enum which defines the optional table type information.
|
Modifier and Type | Field and Description |
---|---|
protected SqlObjectList<SqlObject> |
_constraints |
_columns, _object
ALL_SYMBOL, NULL_VALUE, QUESTION_MARK
Constructor and Description |
---|
CreateTableQuery(Object tableStr)
|
CreateTableQuery(Table table) |
CreateTableQuery(Table table,
boolean includeColumns)
|
Modifier and Type | Method and Description |
---|---|
CreateTableQuery |
addColumn(Column column,
CreateTableQuery.ColumnConstraint constraint)
Deprecated.
use
ConstraintClause instead of ColumnConstraint |
CreateTableQuery |
addColumnConstraint(Column column,
Object constraint)
Adds the constraint on a previously added column
|
CreateTableQuery |
addConstraints(Constraint... constraints)
Adds the given Constraints as table constraints.
|
CreateTableQuery |
addCustomColumn(Object columnStr,
CreateTableQuery.ColumnConstraint constraint)
Deprecated.
use
ConstraintClause instead of ColumnConstraint |
CreateTableQuery |
addCustomColumns(Object... typedColumnStrs)
Adds the given Objects as column descriptions, should look like
"<column> <type> [<constraint> ... |
CreateTableQuery |
addCustomConstraints(Object... constraintStrs)
Adds the given Objects as table constraints, should look like
"<constraint>" . |
CreateTableQuery |
addCustomization(CreateTableQuery.Hook hook,
HookType type,
Object obj)
Adds custom SQL to this query.
|
CreateTableQuery |
addCustomization(CustomSyntax obj)
Adds custom SQL to this query.
|
protected void |
appendTo(AppendableExt app,
SqlContext newContext)
Appends the sql query to the given AppendableExt within the given,
modifiable SqlContext.
|
protected void |
collectSchemaObjects(ValidationContext vContext)
Used during Query.validate() calls to collect the dbschema objects
referenced in a query.
|
DropQuery |
getDropQuery() |
CreateTableQuery |
setColumnConstraint(Column column,
CreateTableQuery.ColumnConstraint constraint)
Deprecated.
use
ConstraintClause instead of ColumnConstraint |
CreateTableQuery |
setColumnDefaultValue(Column column,
Object defaultValue)
Sets the given value as the column default value on a previously added
column
|
CreateTableQuery |
setColumnTypeName(Column column,
String typeName)
Sets the given type name as the column type name on a previously added
column (overriding any type info on the column instance itself).
|
CreateTableQuery |
setTableSpace(String tableSpace)
Deprecated.
Use
addCustomization(new OraTableSpaceClause(tableSpace))
instead. |
CreateTableQuery |
setTableType(CreateTableQuery.TableType tableType)
Sets the type of table to be created.
|
void |
validate(ValidationContext vContext)
Runs validation on this verifiable object using a previously collected
ValidationContext.
|
addColumns, setCustomName, setName
appendTo, getThisType, prependTo, validate, validateTables
addCustomization, customAppendTo, customAppendTo, maybeAppendTo, maybeAppendTo
collectSchemaObjects, doValidate, toString
toString, toString
protected SqlObjectList<SqlObject> _constraints
public CreateTableQuery(Table table)
public CreateTableQuery(Table table, boolean includeColumns)
table
- the table to createincludeColumns
- iff true
, all the columns and
constraints of this table will be added to the
querypublic CreateTableQuery(Object tableStr)
public DropQuery getDropQuery()
getDropQuery
in class BaseCreateQuery<CreateTableQuery>
public CreateTableQuery setTableType(CreateTableQuery.TableType tableType)
public CreateTableQuery addCustomColumns(Object... typedColumnStrs)
"<column> <type> [<constraint> ... ]"
.
Object
-> SqlObject
conversions handled by
Converter.TYPED_COLUMN_TO_OBJ
.
addCustomColumns
in class BaseCreateQuery<CreateTableQuery>
@Deprecated public CreateTableQuery addColumn(Column column, CreateTableQuery.ColumnConstraint constraint)
ConstraintClause
instead of ColumnConstraint@Deprecated public CreateTableQuery addCustomColumn(Object columnStr, CreateTableQuery.ColumnConstraint constraint)
ConstraintClause
instead of ColumnConstraint
Object
-> SqlObject
conversions handled by
Converter.TYPED_COLUMN_TO_OBJ
.
@Deprecated public CreateTableQuery setColumnConstraint(Column column, CreateTableQuery.ColumnConstraint constraint)
ConstraintClause
instead of ColumnConstraintpublic CreateTableQuery addColumnConstraint(Column column, Object constraint)
Object
-> SqlObject
constraint conversions handled by
Converter.toCustomConstraintClause(java.lang.Object)
.
public CreateTableQuery setColumnDefaultValue(Column column, Object defaultValue)
Object
-> SqlObject
value conversions handled by
Converter.toValueSqlObject(java.lang.Object)
.
public CreateTableQuery setColumnTypeName(Column column, String typeName)
public CreateTableQuery addConstraints(Constraint... constraints)
public CreateTableQuery addCustomConstraints(Object... constraintStrs)
"<constraint>"
.
Object
-> SqlObject
conversions handled by
Converter.CUSTOM_TO_CONSTRAINTCLAUSE
.
@Deprecated public CreateTableQuery setTableSpace(String tableSpace)
addCustomization(new OraTableSpaceClause(tableSpace))
instead.TABLESPACE <tableSpace>
to the end of the CREATE
query.
WARNING, this is not ANSI SQL compliant.
OraTableSpaceClause
public CreateTableQuery addCustomization(CreateTableQuery.Hook hook, HookType type, Object obj)
com.healthmarketscience.sqlbuilder.custom
for more details on
custom SQL syntax.hook
- the part of the query being customizedtype
- the type of customizationobj
- the custom sql. The Object
-> SqlObject
conversions handled by Converter.toCustomSqlObject(java.lang.Object)
.public CreateTableQuery addCustomization(CustomSyntax obj)
com.healthmarketscience.sqlbuilder.custom
for more details on
custom SQL syntax.obj
- the custom sql syntax on which the
CustomSyntax.apply(CreateTableQuery)
method will be
invoked (may be null
).protected void collectSchemaObjects(ValidationContext vContext)
SqlObject
collectSchemaObjects
in class BaseCreateQuery<CreateTableQuery>
vContext
- handle to the current validation contextpublic void validate(ValidationContext vContext) throws ValidationException
Verifiable
In general, this method will only be called internally, not by users.
validate
in interface Verifiable<CreateTableQuery>
validate
in class BaseCreateQuery<CreateTableQuery>
vContext
- handle to the current, filled-in validation contextValidationException
protected void appendTo(AppendableExt app, SqlContext newContext) throws IOException
Query
Query.appendTo(AppendableExt)
method within the context of calls to
SqlContext.pushContext(com.healthmarketscience.common.util.AppendableExt)
and SqlContext.popContext(com.healthmarketscience.common.util.AppendableExt, com.healthmarketscience.sqlbuilder.SqlContext)
, so
the implementation is free to modify the given SqlContext.appendTo
in class Query<CreateTableQuery>
app
- the target for the sql query generationnewContext
- modifiable SqlContext for nested AppendeesIOException
Copyright © 2006–2021 OpenHMS. All rights reserved.