Column

This class represents a column in a table.

Methods
void addCheckConstraint(Session session, Expression expr)
Add a check constraint expression to this column.
void addCheckConstraint(Session session, Expression expr)
Add a check constraint expression to this column. An existing check constraint constraint is added using AND.
Parameters:
session - the session
expr - the (additional) constraint
Value computeValue(Session session, Row row)
Compute the value of this computed column.
Value computeValue(Session session, Row row)
Compute the value of this computed column.
Parameters:
session - the session
row - the row
Returns:
the value
Value convert(Value v)
Convert a value to this column's type.
Value convert(Value v)
Convert a value to this column's type.
Parameters:
v - the value
Returns:
the value
Value convert(Value v, Mode mode)
Convert a value to this column's type using the given
Value convert(Value v, Mode mode)
Convert a value to this column's type using the given {@link Mode}.

Use this method in case the conversion is Mode-dependent.

Parameters:
v - the value
mode - the database {@link Mode} to use
Returns:
the value
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 convertAutoIncrementToSequence(Session session, Schema schema, int id, boolean temporary)
Convert the auto-increment flag to a sequence that is linked with this table.
Parameters:
session - the session
schema - the schema where the sequence should be generated
id - the object id
temporary - true if the sequence is temporary and does not need to be stored
void copy(Column source)
Copy the data of the source column into the current column.
void copy(Column source)
Copy the data of the source column into the current column.
Parameters:
source - the source column
boolean equals(Object o)
boolean equals(Object o)
Expression getCheckConstraint(Session session, String asColumnName)
Get the check constraint expression for this column if set.
Expression getCheckConstraint(Session session, String asColumnName)
Get the check constraint expression for this column if set.
Parameters:
session - the session
asColumnName - the column name to use
Returns:
the constraint expression
String getCheckConstraintSQL(Session session, String asColumnName)
Get the check constraint SQL snippet.
String getCheckConstraintSQL(Session session, String asColumnName)
Get the check constraint SQL snippet.
Parameters:
session - the session
asColumnName - the column name to use
Returns:
the SQL snippet
Column getClone()
Column getClone()
int getColumnId()
int getColumnId()
String getComment()
String getComment()
boolean getComputed()
boolean getComputed()
String getCreateSQL()
String getCreateSQL()
String getCreateSQLWithoutName()
String getCreateSQLWithoutName()
DataType getDataType()
DataType getDataType()
Expression getDefaultExpression()
Expression getDefaultExpression()
String getDefaultSQL()
String getDefaultSQL()
int getDisplaySize()
int getDisplaySize()
String[] getEnumerators()
String[] getEnumerators()
String getName()
String getName()
Expression getOnUpdateExpression()
Expression getOnUpdateExpression()
String getOnUpdateSQL()
String getOnUpdateSQL()
String getOriginalSQL()
String getOriginalSQL()
long getPrecision()
long getPrecision()
int getPrecisionAsInt()
int getPrecisionAsInt()
String getSQL()
String getSQL()
int getScale()
int getScale()
int getSelectivity()
Get the selectivity of the column.
int getSelectivity()
Get the selectivity of the column. Selectivity 100 means values are unique, 10 means every distinct value appears 10 times on average.
Returns:
the selectivity
Sequence getSequence()
Sequence getSequence()
Table getTable()
Table getTable()
int getType()
int getType()
boolean getVisible()
boolean getVisible()
int hashCode()
int hashCode()
boolean isAutoIncrement()
boolean isAutoIncrement()
boolean isEnumerated()
boolean isEnumerated()
boolean isEverything(ExpressionVisitor visitor)
Visit the default expression, the check constraint, and the sequence (if any).
boolean isEverything(ExpressionVisitor visitor)
Visit the default expression, the check constraint, and the sequence (if any).
Parameters:
visitor - the visitor
Returns:
true if every visited expression returned true, or if there are no expressions
boolean isNullable()
boolean isNullable()
boolean isPrimaryKey()
boolean isPrimaryKey()
boolean isWideningConversion(Column newColumn)
Check whether the new column is of the same type and not more restricted than this column.
boolean isWideningConversion(Column newColumn)
Check whether the new column is of the same type and not more restricted than this column.
Parameters:
newColumn - the new (target) column
Returns:
true if the new column is compatible
void prepareExpression(Session session)
Prepare all expressions of this column.
void prepareExpression(Session session)
Prepare all expressions of this column.
Parameters:
session - the session
void removeCheckConstraint()
Remove the check constraint if there is one.
void removeCheckConstraint()
Remove the check constraint if there is one.
void rename(String newName)
Rename the column.
void rename(String newName)
Rename the column. This method will only set the column name to the new value.
Parameters:
newName - the new column name
void setAutoIncrement(boolean autoInc, long start, long increment)
Set the autoincrement flag and related properties of this column.
void setAutoIncrement(boolean autoInc, long start, long increment)
Set the autoincrement flag and related properties of this column.
Parameters:
autoInc - the new autoincrement flag
start - the sequence start value
increment - the sequence increment
void setComment(String comment)
void setComment(String comment)
void setComputedExpression(Expression expression)
Set the default value in the form of a computed expression of other columns.
void setComputedExpression(Expression expression)
Set the default value in the form of a computed expression of other columns.
Parameters:
expression - the computed expression
void setConvertNullToDefault(boolean convert)
void setConvertNullToDefault(boolean convert)
void setDefaultExpression(Session session, Expression defaultExpression)
Set the default expression.
void setDefaultExpression(Session session, Expression defaultExpression)
Set the default expression.
Parameters:
session - the session
defaultExpression - the default expression
void setEnumerators(String[] enumerators)
void setEnumerators(String[] enumerators)
void setNullable(boolean b)
void setNullable(boolean b)
void setOnUpdateExpression(Session session, Expression onUpdateExpression)
Set the on update expression.
void setOnUpdateExpression(Session session, Expression onUpdateExpression)
Set the on update expression.
Parameters:
session - the session
onUpdateExpression - the on update expression
void setOriginalSQL(String original)
void setOriginalSQL(String original)
void setPrecision(long p)
void setPrecision(long p)
void setPrimaryKey(boolean primaryKey)
void setPrimaryKey(boolean primaryKey)
void setSelectivity(int selectivity)
Set the new selectivity of a column.
void setSelectivity(int selectivity)
Set the new selectivity of a column.
Parameters:
selectivity - the new value
void setSequence(Sequence sequence)
void setSequence(Sequence sequence)
void setTable(Table table, int columnId)
Set the table and column id.
void setTable(Table table, int columnId)
Set the table and column id.
Parameters:
table - the table
columnId - the column index
void setVisible(boolean b)
void setVisible(boolean b)
String toString()
String toString()
Value validateConvertUpdateSequence(Session session, Value value)
Validate the value, convert it if required, and update the sequence value if required.
Value validateConvertUpdateSequence(Session session, Value value)
Validate the value, convert it if required, and update the sequence value if required. If the value is null, the default value (NULL if no default is set) is returned. Check constraints are validated as well.
Parameters:
session - the session
value - the value or null
Returns:
the new or converted value

Fields
static int NOT_NULLABLE = 0
static int NULLABLE = 1
static int NULLABLE_UNKNOWN = 2
static String ROWID = "_ROWID_"

ROWID = "_ROWID_"

The name of the rowid pseudo column.

NOT_NULLABLE = 0

This column is not nullable.

NULLABLE = 1

This column is nullable.

NULLABLE_UNKNOWN = 2

It is not know whether this column is nullable.