public class Column extends Object
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 String |
ROWID
The name of the rowid pseudo column.
|
Constructor and Description |
---|
Column(String name,
int type) |
Column(String name,
int type,
long precision,
int scale,
int displaySize) |
Column(String name,
int type,
long precision,
int scale,
int displaySize,
String[] enumerators) |
Modifier and Type | Method and Description |
---|---|
void |
addCheckConstraint(Session session,
Expression expr)
Add a check constraint expression to this column.
|
Value |
convert(Value v)
Convert a value to this column's type.
|
Value |
convert(Value v,
Mode mode)
Convert a value to this column's type using the given
Mode . |
void |
convertAutoIncrementToSequence(Session session,
Schema schema,
int id,
boolean temporary)
Convert the auto-increment flag to a sequence that is linked with this
table.
|
void |
copy(Column source)
Copy the data of the source column into the current column.
|
boolean |
equals(Object o) |
Expression |
getCheckConstraint(Session session,
String asColumnName)
Get the check constraint expression for this column if set.
|
Column |
getClone() |
int |
getColumnId() |
String |
getComment() |
String |
getCreateSQL() |
String |
getCreateSQLWithoutName() |
Expression |
getDefaultExpression() |
int |
getDisplaySize() |
String[] |
getEnumerators() |
String |
getName() |
Expression |
getOnUpdateExpression() |
String |
getOriginalSQL() |
long |
getPrecision() |
int |
getScale() |
int |
getSelectivity()
Get the selectivity of the column.
|
Sequence |
getSequence() |
String |
getSQL() |
Table |
getTable() |
int |
getType() |
boolean |
getVisible() |
int |
hashCode() |
boolean |
isAutoIncrement() |
boolean |
isEnumerated() |
boolean |
isNullable() |
boolean |
isPrimaryKey() |
boolean |
isWideningConversion(Column newColumn)
Check whether the new column is of the same type and not more restricted
than this column.
|
void |
prepareExpression(Session session)
Prepare all expressions of this column.
|
void |
removeCheckConstraint()
Remove the check constraint if there is one.
|
void |
rename(String newName)
Rename the column.
|
void |
setAutoIncrement(boolean autoInc,
long start,
long increment)
Set the autoincrement flag and related properties of this column.
|
void |
setComment(String comment) |
void |
setComputedExpression(Expression expression)
Set the default value in the form of a computed expression of other
columns.
|
void |
setConvertNullToDefault(boolean convert) |
void |
setDefaultExpression(Session session,
Expression defaultExpression)
Set the default expression.
|
void |
setEnumerators(String[] enumerators) |
void |
setNullable(boolean b) |
void |
setOnUpdateExpression(Session session,
Expression onUpdateExpression)
Set the on update expression.
|
void |
setOriginalSQL(String original) |
void |
setPrecision(long p) |
void |
setPrimaryKey(boolean primaryKey) |
void |
setSelectivity(int selectivity)
Set the new selectivity of a column.
|
void |
setSequence(Sequence sequence) |
void |
setTable(Table table,
int columnId)
Set the table and column id.
|
void |
setVisible(boolean b) |
String |
toString() |
Value |
validateConvertUpdateSequence(Session session,
Value value)
Validate the value, convert it if required, and update the sequence value
if required.
|
public static final String ROWID
public static final int NOT_NULLABLE
public static final int NULLABLE
public static final int NULLABLE_UNKNOWN
public Column(String name, int type)
public Column(String name, int type, long precision, int scale, int displaySize)
public boolean isEnumerated()
public Column getClone()
public Value convert(Value v)
v
- the valuepublic Value convert(Value v, Mode mode)
Mode
.
Use this method in case the conversion is Mode-dependent.
v
- the valuemode
- the database Mode
to usepublic void setComputedExpression(Expression expression)
expression
- the computed expressionpublic void setTable(Table table, int columnId)
table
- the tablecolumnId
- the column indexpublic Table getTable()
public void setDefaultExpression(Session session, Expression defaultExpression)
session
- the sessiondefaultExpression
- the default expressionpublic void setOnUpdateExpression(Session session, Expression onUpdateExpression)
session
- the sessiononUpdateExpression
- the on update expressionpublic int getColumnId()
public String getSQL()
public String getName()
public int getType()
public long getPrecision()
public void setPrecision(long p)
public int getDisplaySize()
public int getScale()
public void setNullable(boolean b)
public String[] getEnumerators()
public void setEnumerators(String[] enumerators)
public boolean getVisible()
public void setVisible(boolean b)
public Value validateConvertUpdateSequence(Session session, Value value)
session
- the sessionvalue
- the value or nullpublic void convertAutoIncrementToSequence(Session 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 prepareExpression(Session session)
session
- the sessionpublic String getCreateSQLWithoutName()
public String getCreateSQL()
public boolean isNullable()
public void setOriginalSQL(String original)
public String getOriginalSQL()
public Expression getDefaultExpression()
public Expression getOnUpdateExpression()
public boolean isAutoIncrement()
public void setAutoIncrement(boolean autoInc, long start, long increment)
autoInc
- the new autoincrement flagstart
- the sequence start valueincrement
- the sequence incrementpublic void setConvertNullToDefault(boolean convert)
public void rename(String newName)
newName
- the new column namepublic void setSequence(Sequence sequence)
public Sequence getSequence()
public int getSelectivity()
public void setSelectivity(int selectivity)
selectivity
- the new valuepublic void addCheckConstraint(Session session, Expression expr)
session
- the sessionexpr
- the (additional) constraintpublic void removeCheckConstraint()
public Expression getCheckConstraint(Session session, String asColumnName)
session
- the sessionasColumnName
- the column name to usepublic 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 © 2020 JBoss by Red Hat. All rights reserved.