public class CreateTableColumn extends H2SqlPart
Generates a column definition for a CREATE TABLE statement for H2.
email TEXT NOT NULL, CONSTRAINT "email_check" CHECK (email LIKE '%@%')
| Constructor and Description |
|---|
CreateTableColumn() |
CreateTableColumn(String columnName,
TableColumnType type)
Constructs a CreateTableColumn with the specified column name and type.
|
CreateTableColumn(String columnName,
TableColumnType type,
Integer length)
Constructs a CreateTableColumn with the specified column name, type, and length.
|
CreateTableColumn(String columnName,
TableColumnType type,
Integer length,
Integer scale)
Constructs a CreateTableColumn with the specified column name, type, length, and scale.
|
| Modifier and Type | Method and Description |
|---|---|
void |
collectSqlFragment(CodeWriter writer) |
String |
getCheckConstraintCondition()
Returns the check constraint condition.
|
String |
getCheckConstraintName()
Returns the check constraint name.
|
String |
getColumnName()
Returns the column name.
|
String |
getDefaultValue()
Returns the default value.
|
Integer |
getLength()
Returns the column length.
|
Integer |
getScale()
Returns the column scale.
|
TableColumnType |
getType()
Returns the column type.
|
boolean |
isAutoIncrement()
Returns whether the column has auto-increment enabled.
|
boolean |
isNullable()
Returns whether the column is nullable.
|
boolean |
isPrimaryKey()
Returns whether the column is a primary key.
|
boolean |
isUnique()
Returns whether the column has a unique constraint.
|
CreateTableColumn |
setAutoIncrement(boolean autoIncrement)
Sets whether the column has auto-increment enabled.
|
CreateTableColumn |
setCheckConstraint(String checkConstraintName,
String condition)
Sets the check constraint name and condition.
|
CreateTableColumn |
setCheckConstraintCondition(String checkConstraintCondition)
Sets the check constraint condition.
|
CreateTableColumn |
setCheckConstraintName(String checkConstraintName)
Sets the check constraint name.
|
CreateTableColumn |
setColumnName(String columnName)
Sets the column name.
|
CreateTableColumn |
setDefaultValue(String defaultValue)
Sets the default value.
|
CreateTableColumn |
setLength(Integer length)
Sets the column length.
|
CreateTableColumn |
setNullable(boolean nullable)
Sets whether the column is nullable.
|
CreateTableColumn |
setPretty(boolean pretty) |
CreateTableColumn |
setPrimaryKey(boolean primaryKey)
Sets whether the column is a primary key.
|
CreateTableColumn |
setScale(Integer scale)
Sets the column scale.
|
CreateTableColumn |
setType(TableColumnType type)
Sets the column type.
|
CreateTableColumn |
setUnique(boolean unique)
Sets whether the column has a unique constraint.
|
escapeKeyword, placeBackTickscollectParameterValues, getParameterValues, getSqlFragment, isPretty, printSqlParts, toStringpublic CreateTableColumn()
public CreateTableColumn(String columnName, TableColumnType type, Integer length, Integer scale)
columnName - the column nametype - the column typelength - the column lengthscale - the column scalepublic CreateTableColumn(String columnName, TableColumnType type, Integer length)
columnName - the column nametype - the column typelength - the column lengthpublic CreateTableColumn(String columnName, TableColumnType type)
columnName - the column nametype - the column typepublic CreateTableColumn setPretty(boolean pretty)
public void collectSqlFragment(CodeWriter writer)
collectSqlFragment in class SqlPartpublic String getColumnName()
public CreateTableColumn setColumnName(String columnName)
columnName - the column namepublic TableColumnType getType()
public CreateTableColumn setType(TableColumnType type)
type - the column typepublic Integer getLength()
public CreateTableColumn setLength(Integer length)
length - the column lengthpublic Integer getScale()
public CreateTableColumn setScale(Integer scale)
scale - the column scalepublic boolean isNullable()
public CreateTableColumn setNullable(boolean nullable)
nullable - true if the column is nullablepublic boolean isUnique()
public CreateTableColumn setUnique(boolean unique)
unique - true if the column has a unique constraintpublic String getDefaultValue()
public CreateTableColumn setDefaultValue(String defaultValue)
defaultValue - the default valuepublic String getCheckConstraintCondition()
public CreateTableColumn setCheckConstraintCondition(String checkConstraintCondition)
checkConstraintCondition - the check constraint conditionpublic String getCheckConstraintName()
public CreateTableColumn setCheckConstraintName(String checkConstraintName)
checkConstraintName - the check constraint namepublic CreateTableColumn setCheckConstraint(String checkConstraintName, String condition)
checkConstraintName - the check constraint namecondition - the check constraint conditionpublic boolean isPrimaryKey()
public CreateTableColumn setPrimaryKey(boolean primaryKey)
primaryKey - true if the column is a primary keypublic boolean isAutoIncrement()
public CreateTableColumn setAutoIncrement(boolean autoIncrement)
autoIncrement - true if the column has auto-increment enabledCopyright (c) 2006-2026 North Concepts Inc. All Rights Reserved.