Top Description Inners Fields Constructors Methods
org.h2.constraint

public Class ConstraintDomain

extends Constraint
Class Inheritance
Imports
java.util.HashSet, org.h2.api.ErrorCode, org.h2.command.Parser, org.h2.command.ddl.AlterDomain, org.h2.command.query.AllColumnsForPlan, org.h2.engine.SessionLocal, org.h2.expression.Expression, .ExpressionVisitor, org.h2.index.Index, org.h2.message.DbException, org.h2.result.Row, org.h2.schema.Domain, .Schema, org.h2.table.Column, .PlanItem, .Table, .TableFilter, org.h2.util.StringUtils, org.h2.value.Value, .ValueNull

A domain constraint.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private Domain
private Expression
private DomainColumnResolver
Inherited from org.h2.constraint.Constraint:
table

Constructor Summary

AccessConstructor and Description
public
ConstraintDomain(Schema schema, int id, String name, Domain domain)

Method Summary

Modifier and TypeMethod and Description
public void
check(SessionLocal
the session
session
,
Value
the value to check
value
)

Check the specified value.

public void
checkExistingData(SessionLocal
the session
session
)

Implements abstract org.h2.constraint.Constraint.checkExistingData.

Check the existing data.

public void
checkRow(SessionLocal
the session
session
,
Table
the table
t
,
Row
the old row
oldRow
,
Row
the new row
newRow
)

Implements abstract org.h2.constraint.Constraint.checkRow.

Check if this row fulfils the constraint.

public Expression

Returns:

the expression
getCheckConstraint
(SessionLocal
the session
session
,
String
the column name
columnName
)

Get the check constraint expression for this column.

public Constraint.Type
getConstraintType()

Implements abstract org.h2.constraint.Constraint.getConstraintType.

The constraint type name

public String
getCreateSQL()

Implements abstract org.h2.engine.DbObject.getCreateSQL.

Construct the CREATE ...

public String
getCreateSQLWithoutIndexes()

Implements abstract org.h2.constraint.Constraint.getCreateSQLWithoutIndexes.

Get the SQL statement to create this constraint.

public Domain

Returns:

the domain
getDomain
()

Returns the domain of this constraint.

public Expression
getExpression()

Overrides org.h2.constraint.Constraint.getExpression.

Returns the CHECK expression or null.

public HashSet<Column>
getReferencedColumns(Table
the table
table
)

Implements abstract org.h2.constraint.Constraint.getReferencedColumns.

Get all referenced columns.

public boolean
isBefore()

Implements abstract org.h2.constraint.Constraint.isBefore.

Check if this constraint needs to be checked before updating the data.

public boolean
isEverything(ExpressionVisitor
the visitor
visitor
)

Overrides org.h2.constraint.Constraint.isEverything.

Visit all elements in the constraint.

public void
rebuild()

Implements abstract org.h2.constraint.Constraint.rebuild.

This method is called after a related table has changed (the table was renamed, or columns have been renamed).

public void
removeChildrenAndResources(SessionLocal
the session
session
)

Implements abstract org.h2.engine.DbObject.removeChildrenAndResources.

Delete all dependent children objects and resources of this object.

public void
setExpression(SessionLocal
the session
session
,
Expression
the expression
expr
)

Set the expression.

public void
setIndexOwner(Index
the index
index
)

Implements abstract org.h2.constraint.Constraint.setIndexOwner.

This index is now the owner of the specified index.

public boolean
usesIndex(Index
the index
index
)

Implements abstract org.h2.constraint.Constraint.usesIndex.

Check if this constraint needs the specified index.

Inherited from org.h2.constraint.Constraint:
compareTogetIndexgetReferencedConstraintgetRefTablegetTablegetType

Field Detail

domainback to summary
private Domain domain
exprback to summary
private Expression expr
resolverback to summary
private DomainColumnResolver resolver

Constructor Detail

ConstraintDomainback to summary
public ConstraintDomain(Schema schema, int id, String name, Domain domain)

Method Detail

checkback to summary
public void check(SessionLocal session, Value value)

Check the specified value.

Parameters
session:SessionLocal

the session

value:Value

the value to check

checkExistingDataback to summary
public void checkExistingData(SessionLocal session)

Implements abstract org.h2.constraint.Constraint.checkExistingData.

Doc from org.h2.constraint.Constraint.checkExistingData.

Check the existing data. This method is called if the constraint is added after data has been inserted into the table.

Parameters
session:SessionLocal

the session

Annotations
@Override
checkRowback to summary
public void checkRow(SessionLocal session, Table t, Row oldRow, Row newRow)

Implements abstract org.h2.constraint.Constraint.checkRow.

Doc from org.h2.constraint.Constraint.checkRow.

Check if this row fulfils the constraint. This method throws an exception if not.

Parameters
session:SessionLocal

the session

t:Table

the table

oldRow:Row

the old row

newRow:Row

the new row

Annotations
@Override
getCheckConstraintback to summary
public Expression getCheckConstraint(SessionLocal session, String columnName)

Get the check constraint expression for this column.

Parameters
session:SessionLocal

the session

columnName:String

the column name

Returns:Expression

the expression

getConstraintTypeback to summary
public Constraint.Type getConstraintType()

Implements abstract org.h2.constraint.Constraint.getConstraintType.

Doc from org.h2.constraint.Constraint.getConstraintType.

The constraint type name

Returns:Constraint.Type

the name

Annotations
@Override
getCreateSQLback to summary
public String getCreateSQL()

Implements abstract org.h2.engine.DbObject.getCreateSQL.

Doc from org.h2.engine.DbObject.getCreateSQL.

Construct the CREATE ... SQL statement for this object.

Returns:String

the SQL statement

Annotations
@Override
getCreateSQLWithoutIndexesback to summary
public String getCreateSQLWithoutIndexes()

Implements abstract org.h2.constraint.Constraint.getCreateSQLWithoutIndexes.

Doc from org.h2.constraint.Constraint.getCreateSQLWithoutIndexes.

Get the SQL statement to create this constraint.

Returns:String

the SQL statement

Annotations
@Override
getDomainback to summary
public Domain getDomain()

Returns the domain of this constraint.

Returns:Domain

the domain

getExpressionback to summary
public Expression getExpression()

Overrides org.h2.constraint.Constraint.getExpression.

Doc from org.h2.constraint.Constraint.getExpression.

Returns the CHECK expression or null.

Returns:Expression

the CHECK expression or null.

Annotations
@Override
getReferencedColumnsback to summary
public HashSet<Column> getReferencedColumns(Table table)

Implements abstract org.h2.constraint.Constraint.getReferencedColumns.

Doc from org.h2.constraint.Constraint.getReferencedColumns.

Get all referenced columns.

Parameters
table:Table

the table

Returns:HashSet<Column>

the set of referenced columns

Annotations
@Override
isBeforeback to summary
public boolean isBefore()

Implements abstract org.h2.constraint.Constraint.isBefore.

Doc from org.h2.constraint.Constraint.isBefore.

Check if this constraint needs to be checked before updating the data.

Returns:boolean

true if it must be checked before updating

Annotations
@Override
isEverythingback to summary
public boolean isEverything(ExpressionVisitor visitor)

Overrides org.h2.constraint.Constraint.isEverything.

Doc from org.h2.constraint.Constraint.isEverything.

Visit all elements in the constraint.

Parameters
visitor:ExpressionVisitor

the visitor

Returns:boolean

true if every visited expression returned true, or if there are no expressions

Annotations
@Override
rebuildback to summary
public void rebuild()

Implements abstract org.h2.constraint.Constraint.rebuild.

Doc from org.h2.constraint.Constraint.rebuild.

This method is called after a related table has changed (the table was renamed, or columns have been renamed).

Annotations
@Override
removeChildrenAndResourcesback to summary
public void removeChildrenAndResources(SessionLocal session)

Implements abstract org.h2.engine.DbObject.removeChildrenAndResources.

Doc from org.h2.engine.DbObject.removeChildrenAndResources.

Delete all dependent children objects and resources of this object.

Parameters
session:SessionLocal

the session

Annotations
@Override
setExpressionback to summary
public void setExpression(SessionLocal session, Expression expr)

Set the expression.

Parameters
session:SessionLocal

the session

expr:Expression

the expression

setIndexOwnerback to summary
public void setIndexOwner(Index index)

Implements abstract org.h2.constraint.Constraint.setIndexOwner.

Doc from org.h2.constraint.Constraint.setIndexOwner.

This index is now the owner of the specified index.

Parameters
index:Index

the index

Annotations
@Override
usesIndexback to summary
public boolean usesIndex(Index index)

Implements abstract org.h2.constraint.Constraint.usesIndex.

Doc from org.h2.constraint.Constraint.usesIndex.

Check if this constraint needs the specified index.

Parameters
index:Index

the index

Returns:boolean

true if the index is used

Annotations
@Override
org.h2.constraint back to summary

private Class ConstraintDomain.CheckExistingData

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final SessionLocal

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private boolean
checkColumn(Domain domain, Column targetColumn)

private boolean
checkDomain(Domain domain, Domain targetDomain)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sessionback to summary
private final SessionLocal session

Constructor Detail

CheckExistingDataback to summary
pack-priv CheckExistingData(SessionLocal session, Domain domain)

Method Detail

checkColumnback to summary
private boolean checkColumn(Domain domain, Column targetColumn)
checkDomainback to summary
private boolean checkDomain(Domain domain, Domain targetDomain)