Top Description Fields Constructors Methods
org.h2.constraint

public Class ConstraintCheck

extends Constraint
Class Inheritance
Imports
java.util.HashSet, org.h2.api.ErrorCode, org.h2.engine.SessionLocal, org.h2.expression.Expression, .ExpressionVisitor, org.h2.index.Index, org.h2.message.DbException, org.h2.result.ResultInterface, .Row, org.h2.schema.Schema, org.h2.table.Column, .Table, .TableFilter, org.h2.util.StringUtils, org.h2.value.Value

A check constraint.

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
ConstraintCheck(Schema schema, int id, String name, Table table)

Method Summary

Modifier and TypeMethod and Description
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 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
getCreateSQLForCopy(Table
the new table
forTable
,
String
the quoted name
quotedName
)

Overrides org.h2.engine.DbObject.getCreateSQLForCopy.

Build a SQL statement to re-create the object, or to create a copy of the object with a different name or referencing a different table

public String
getCreateSQLWithoutIndexes()

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

Get the SQL statement to create 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.

private String
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
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 void
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

exprback to summary
private Expression expr
filterback to summary
private TableFilter filter

Constructor Detail

ConstraintCheckback to summary
public ConstraintCheck(Schema schema, int id, String name, Table table)

Method Detail

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
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
getCreateSQLForCopyback to summary
public String getCreateSQLForCopy(Table forTable, String quotedName)

Overrides org.h2.engine.DbObject.getCreateSQLForCopy.

Doc from org.h2.engine.DbObject.getCreateSQLForCopy.

Build a SQL statement to re-create the object, or to create a copy of the object with a different name or referencing a different table

Parameters
forTable:Table

the new table

quotedName:String

the quoted name

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
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
getShortDescriptionback to summary
private String getShortDescription()
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(Expression expr)
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
setTableFilterback to summary
public void setTableFilter(TableFilter filter)
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