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) |
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.
|
void |
convertAutoIncrementToSequence(Session session,
Schema schema,
int id,
boolean temporary)
Convert the auto-increment flag to a sequence that is linked with this
table.
|
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() |
Expression |
getDefaultExpression() |
int |
getDisplaySize() |
String |
getName() |
String |
getOriginalSQL() |
long |
getPrecision() |
int |
getScale() |
int |
getSelectivity()
Get the selectivity of the column.
|
Sequence |
getSequence() |
String |
getSQL() |
Table |
getTable() |
int |
getType() |
int |
hashCode() |
boolean |
isAutoIncrement() |
boolean |
isNullable() |
boolean |
isPrimaryKey() |
void |
prepareExpression(Session session)
Prepare all expressions of this column.
|
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 |
setNullable(boolean b) |
void |
setOriginalSQL(String original) |
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.
|
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 Column getClone()
public Value convert(Value v)
v
- the valuepublic 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 int getColumnId()
public String getSQL()
public String getName()
public int getType()
public long getPrecision()
public int getDisplaySize()
public int getScale()
public void setNullable(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 getCreateSQL()
public boolean isNullable()
public void setOriginalSQL(String original)
public String getOriginalSQL()
public Expression getDefaultExpression()
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 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()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.