public final class Column extends Object implements HasSQL, Typed, ColumnTemplate
| 限定符和类型 | 字段和说明 |
|---|---|
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 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| 构造器和说明 |
|---|
Column(String name,
TypeInfo type) |
Column(String name,
TypeInfo type,
Table table,
int columnId) |
| 限定符和类型 | 方法和说明 |
|---|---|
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(Object o) |
Column |
getClone() |
int |
getColumnId() |
String |
getComment() |
String |
getCreateSQL() |
String |
getCreateSQL(boolean forMeta)
Get this columns part of CREATE TABLE SQL statement.
|
String |
getCreateSQLWithoutName() |
Expression |
getDefaultExpression() |
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. |
String |
getName() |
Expression |
getOnUpdateExpression() |
String |
getOnUpdateSQL() |
int |
getSelectivity()
Get the selectivity of the column.
|
Sequence |
getSequence() |
String |
getSQL(int sqlFlags)
Get the SQL statement of this expression.
|
StringBuilder |
getSQL(StringBuilder builder,
int sqlFlags)
Appends the SQL statement of this object to the specified builder.
|
StringBuilder |
getSQLWithTable(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(String newName)
Rename the column.
|
void |
setComment(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) |
String |
toString() |
static StringBuilder |
writeColumns(StringBuilder builder,
Column[] columns,
int sqlFlags)
Appends the specified columns to the specified builder.
|
static StringBuilder |
writeColumns(StringBuilder builder,
Column[] columns,
String separator,
String suffix,
int sqlFlags)
Appends the specified columns to the specified builder.
|
getTraceSQLpublic static final int NOT_NULLABLE
public static final int NULLABLE
public static final int NULLABLE_UNKNOWN
public static StringBuilder writeColumns(StringBuilder builder, Column[] columns, int sqlFlags)
builder - string buildercolumns - columnssqlFlags - formatting flagspublic static StringBuilder writeColumns(StringBuilder builder, Column[] columns, String separator, String suffix, int sqlFlags)
builder - string buildercolumns - columnsseparator - separatorsuffix - additional SQL to append after each columnsqlFlags - formatting flagspublic 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 在接口中 ColumnTemplatesession - the sessiondefaultExpression - the default expressionpublic void setOnUpdateExpression(SessionLocal session, Expression onUpdateExpression)
ColumnTemplatesetOnUpdateExpression 在接口中 ColumnTemplatesession - the sessiononUpdateExpression - the on update expressionpublic int getColumnId()
public String getSQL(int sqlFlags)
HasSQLpublic StringBuilder getSQL(StringBuilder builder, int sqlFlags)
HasSQLpublic StringBuilder getSQLWithTable(StringBuilder builder, int sqlFlags)
builder - the string buildersqlFlags - formatting flagspublic String getName()
public void setNullable(boolean b)
public boolean getVisible()
public void setVisible(boolean b)
public Domain getDomain()
getDomain 在接口中 ColumnTemplatepublic void setDomain(Domain domain)
setDomain 在接口中 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 在接口中 ColumnTemplatesession - the sessionpublic String getCreateSQLWithoutName()
public String getCreateSQL()
public String getCreateSQL(boolean forMeta)
forMeta - whether this is for the metadata tablepublic boolean isNullable()
public Expression getDefaultExpression()
getDefaultExpression 在接口中 ColumnTemplatepublic Expression getEffectiveDefaultExpression()
getEffectiveDefaultExpression 在接口中 ColumnTemplatepublic Expression getOnUpdateExpression()
getOnUpdateExpression 在接口中 ColumnTemplatepublic Expression getEffectiveOnUpdateExpression()
getEffectiveOnUpdateExpression 在接口中 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(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 String getDefaultSQL()
getDefaultSQL 在接口中 ColumnTemplatepublic String getOnUpdateSQL()
getOnUpdateSQL 在接口中 ColumnTemplatepublic void setComment(String comment)
public String getComment()
public void setPrimaryKey(boolean primaryKey)
public boolean isPrimaryKey()
public boolean isWideningConversion(Column newColumn)
newColumn - the new (target) columnpublic void copy(Column source)
source - the source columnCopyright © 2022. All rights reserved.