public final class Column extends java.lang.Object implements HasSQL, Typed, ColumnTemplate
| Modifier and Type | Field and Description |
|---|---|
static int |
NOT_NULLABLE
This column is not nullable.
|
static int |
NULLABLE
This column is nullable.
|
static int |
NULLABLE_UNKNOWN
It is not know whether this column is nullable.
|
static java.lang.String |
ROWID
The name of the rowid pseudo column.
|
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS| Constructor and Description |
|---|
Column(java.lang.String name,
TypeInfo type) |
Column(java.lang.String name,
TypeInfo type,
Table table,
int columnId) |
| Modifier and Type | Method and Description |
|---|---|
Value |
convert(CastDataProvider provider,
Value v)
Convert a value to this column's type without precision and scale checks.
|
void |
copy(Column source)
Copy the data of the source column into the current column.
|
boolean |
equals(java.lang.Object o) |
Column |
getClone() |
int |
getColumnId() |
java.lang.String |
getComment() |
java.lang.String |
getCreateSQL() |
java.lang.String |
getCreateSQL(boolean forMeta)
Get this columns part of CREATE TABLE SQL statement.
|
java.lang.String |
getCreateSQLWithoutName() |
Expression |
getDefaultExpression() |
java.lang.String |
getDefaultSQL() |
Domain |
getDomain() |
Expression |
getEffectiveDefaultExpression() |
Expression |
getEffectiveOnUpdateExpression() |
SequenceOptions |
getIdentityOptions()
Returns identity column options, or
null if sequence was already
created or this column is not an identity column. |
java.lang.String |
getName() |
Expression |
getOnUpdateExpression() |
java.lang.String |
getOnUpdateSQL() |
int |
getSelectivity()
Get the selectivity of the column.
|
Sequence |
getSequence() |
java.lang.String |
getSQL(int sqlFlags)
Get the SQL statement of this expression.
|
java.lang.StringBuilder |
getSQL(java.lang.StringBuilder builder,
int sqlFlags)
Appends the SQL statement of this object to the specified builder.
|
java.lang.StringBuilder |
getSQLWithTable(java.lang.StringBuilder builder,
int sqlFlags)
Appends the table name and column name to the specified builder.
|
Table |
getTable() |
TypeInfo |
getType()
Returns the data type.
|
boolean |
getVisible() |
int |
hashCode() |
boolean |
hasIdentityOptions()
Whether the column has any identity options.
|
void |
initializeSequence(SessionLocal session,
Schema schema,
int id,
boolean temporary)
Initialize the sequence for this column.
|
boolean |
isDefaultOnNull() |
boolean |
isGenerated()
Returns whether this column is a generated column.
|
boolean |
isGeneratedAlways()
Returns whether this column is a generated column or always generated
identity column.
|
boolean |
isIdentity()
Returns whether this column is an identity column.
|
boolean |
isNullable() |
boolean |
isPrimaryKey() |
boolean |
isRowId()
Returns whether this column is a row identity column.
|
boolean |
isWideningConversion(Column newColumn)
Check whether the new column is of the same type and not more restricted
than this column.
|
void |
prepareExpressions(SessionLocal session)
Prepare all expressions of this column or domain.
|
void |
rename(java.lang.String newName)
Rename the column.
|
void |
setComment(java.lang.String comment) |
void |
setDefaultExpression(SessionLocal session,
Expression defaultExpression)
Set the default expression.
|
void |
setDefaultOnNull(boolean defaultOnNull) |
void |
setDomain(Domain domain) |
void |
setGeneratedExpression(Expression expression)
Set the default value in the form of a generated expression of other
columns.
|
void |
setIdentityOptions(SequenceOptions identityOptions,
boolean generatedAlways)
Set the identity options of this column.
|
void |
setNullable(boolean b) |
void |
setOnUpdateExpression(SessionLocal session,
Expression onUpdateExpression)
Set the on update expression.
|
void |
setPrimaryKey(boolean primaryKey) |
void |
setRowId(boolean rowId)
Set row identity flag.
|
void |
setSelectivity(int selectivity)
Set the new selectivity of a column.
|
void |
setSequence(Sequence sequence,
boolean generatedAlways)
Set the sequence to generate the value.
|
void |
setTable(Table table,
int columnId)
Set the table and column id.
|
void |
setVisible(boolean b) |
java.lang.String |
toString() |
static java.lang.StringBuilder |
writeColumns(java.lang.StringBuilder builder,
Column[] columns,
int sqlFlags)
Appends the specified columns to the specified builder.
|
static java.lang.StringBuilder |
writeColumns(java.lang.StringBuilder builder,
Column[] columns,
java.lang.String separator,
java.lang.String suffix,
int sqlFlags)
Appends the specified columns to the specified builder.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetTraceSQLpublic static final java.lang.String ROWID
public static final int NOT_NULLABLE
public static final int NULLABLE
public static final int NULLABLE_UNKNOWN
public Column(java.lang.String name,
TypeInfo type)
public static java.lang.StringBuilder writeColumns(java.lang.StringBuilder builder,
Column[] columns,
int sqlFlags)
builder - string buildercolumns - columnssqlFlags - formatting flagspublic static java.lang.StringBuilder writeColumns(java.lang.StringBuilder builder,
Column[] columns,
java.lang.String separator,
java.lang.String suffix,
int sqlFlags)
builder - string buildercolumns - columnsseparator - separatorsuffix - additional SQL to append after each columnsqlFlags - formatting flagspublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic Column getClone()
public Value convert(CastDataProvider provider, Value v)
provider - the cast information providerv - the valuepublic boolean isIdentity()
public boolean isGenerated()
public boolean isGeneratedAlways()
public void setGeneratedExpression(Expression expression)
expression - the computed expressionpublic void setTable(Table table, int columnId)
table - the tablecolumnId - the column indexpublic Table getTable()
public void setDefaultExpression(SessionLocal session, Expression defaultExpression)
ColumnTemplatesetDefaultExpression in interface ColumnTemplatesession - the sessiondefaultExpression - the default expressionpublic void setOnUpdateExpression(SessionLocal session, Expression onUpdateExpression)
ColumnTemplatesetOnUpdateExpression in interface ColumnTemplatesession - the sessiononUpdateExpression - the on update expressionpublic int getColumnId()
public java.lang.String getSQL(int sqlFlags)
HasSQLpublic java.lang.StringBuilder getSQL(java.lang.StringBuilder builder,
int sqlFlags)
HasSQLpublic java.lang.StringBuilder getSQLWithTable(java.lang.StringBuilder builder,
int sqlFlags)
builder - the string buildersqlFlags - formatting flagspublic java.lang.String getName()
public void setNullable(boolean b)
public boolean getVisible()
public void setVisible(boolean b)
public Domain getDomain()
getDomain in interface ColumnTemplatepublic void setDomain(Domain domain)
setDomain in interface ColumnTemplatepublic boolean isRowId()
public void setRowId(boolean rowId)
rowId - true _ROWID_ column, false otherwisepublic void initializeSequence(SessionLocal session, Schema schema, int id, boolean temporary)
session - the sessionschema - the schema where the sequence should be generatedid - the object idtemporary - true if the sequence is temporary and does not need to
be storedpublic void prepareExpressions(SessionLocal session)
ColumnTemplateprepareExpressions in interface ColumnTemplatesession - the sessionpublic java.lang.String getCreateSQLWithoutName()
public java.lang.String getCreateSQL()
public java.lang.String getCreateSQL(boolean forMeta)
forMeta - whether this is for the metadata tablepublic boolean isNullable()
public Expression getDefaultExpression()
getDefaultExpression in interface ColumnTemplatepublic Expression getEffectiveDefaultExpression()
getEffectiveDefaultExpression in interface ColumnTemplatepublic Expression getOnUpdateExpression()
getOnUpdateExpression in interface ColumnTemplatepublic Expression getEffectiveOnUpdateExpression()
getEffectiveOnUpdateExpression in interface ColumnTemplatepublic boolean hasIdentityOptions()
public void setIdentityOptions(SequenceOptions identityOptions, boolean generatedAlways)
identityOptions - identity column optionsgeneratedAlways - whether value should be always generatedpublic SequenceOptions getIdentityOptions()
null if sequence was already
created or this column is not an identity column.nullpublic void setDefaultOnNull(boolean defaultOnNull)
public boolean isDefaultOnNull()
public void rename(java.lang.String newName)
newName - the new column namepublic void setSequence(Sequence sequence, boolean generatedAlways)
sequence - the sequencegeneratedAlways - whether the value of the sequence is always usedpublic Sequence getSequence()
public int getSelectivity()
public void setSelectivity(int selectivity)
selectivity - the new valuepublic java.lang.String getDefaultSQL()
getDefaultSQL in interface ColumnTemplatepublic java.lang.String getOnUpdateSQL()
getOnUpdateSQL in interface ColumnTemplatepublic void setComment(java.lang.String comment)
public java.lang.String getComment()
public void setPrimaryKey(boolean primaryKey)
public boolean isPrimaryKey()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isWideningConversion(Column newColumn)
newColumn - the new (target) columnpublic void copy(Column source)
source - the source column