|
|||||||||
| Home >> All >> org >> [ hsqldb overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.hsqldb
Class Constraint

java.lang.Objectorg.hsqldb.Constraint
- class Constraint
- extends java.lang.Object
Implementation of a table constraint with references to the indexes used by the constraint.
- Version:
- 1.7.0
| Field Summary | |
private HsqlName |
constName
|
private ConstraintCore |
core
|
(package private) static int |
FOREIGN_KEY
|
private int |
iType
|
(package private) static int |
MAIN
|
(package private) static int |
UNIQUE
|
| Constructor Summary | |
private |
Constraint()
|
(package private) |
Constraint(HsqlName name,
Constraint fkconstraint)
Constructor for main constraints (foreign key references in PK table) |
(package private) |
Constraint(HsqlName pkname,
HsqlName fkname,
Table main,
Table ref,
int[] colmain,
int[] colref,
Index imain,
Index iref,
boolean cascade)
Constructor for foreign key constraints |
(package private) |
Constraint(HsqlName name,
Table t,
Index index)
Constructor declaration |
| Method Summary | |
private void |
checkDelete(java.lang.Object[] row)
Check if a row in the referenced (parent) table can be deleted. |
(package private) void |
checkInsert(java.lang.Object[] row)
Checks for foreign key violation when inserting a row in the child table. |
(package private) void |
checkUpdate(int[] col,
Result deleted,
Result inserted)
Checks if updating a set of columns in a table row breaks the referential integrity constraint. |
(package private) Node |
findFkRef(java.lang.Object[] row)
New method to find any referencing node (containing the row) for a foreign key (finds row in child table). |
(package private) java.lang.String |
getFkName()
probably a misnomer, but DatabaseMetaData.getCrossReference specifies it this way (I suppose because most FKs are declared against the PK of another table) |
(package private) Table |
getMain()
Method declaration |
(package private) int[] |
getMainColumns()
Method declaration |
(package private) Index |
getMainIndex()
|
(package private) HsqlName |
getName()
|
(package private) java.lang.String |
getPkName()
probably a misnomer, but DatabaseMetaData.getCrossReference specifies it this way (I suppose because most FKs are declared against the PK of another table) |
(package private) Table |
getRef()
Method declaration |
(package private) int[] |
getRefColumns()
Method declaration |
(package private) Index |
getRefIndex()
|
(package private) int |
getType()
Method declaration |
(package private) boolean |
isCascade()
Does (foreign key) constraint cascade on delete |
(package private) boolean |
isEquivalent(int[] col,
int type)
Compares this with another constraint column set. |
(package private) boolean |
isIndexFK(Index index)
See if an index is part this constraint and the constraint is set for a foreign key. |
(package private) boolean |
isIndexUnique(Index index)
See if an index is part this constraint and the constraint is set for a unique constraint. |
(package private) void |
replaceTable(Table oldt,
Table newt,
int colindex,
int adjust)
Used to update constrains to reflect structural changes in a table. |
private void |
setName(java.lang.String name,
boolean isquoted)
Changes constraint name. |
private void |
setTableRows()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
FOREIGN_KEY
static final int FOREIGN_KEY
- See Also:
- Constant Field Values
MAIN
static final int MAIN
- See Also:
- Constant Field Values
UNIQUE
static final int UNIQUE
- See Also:
- Constant Field Values
core
private ConstraintCore core
constName
private HsqlName constName
iType
private int iType
| Constructor Detail |
Constraint
Constraint(HsqlName name, Table t, Index index)
- Constructor declaration
Constraint
Constraint(HsqlName name, Constraint fkconstraint)
- Constructor for main constraints (foreign key references in PK table)
Constraint
Constraint(HsqlName pkname, HsqlName fkname, Table main, Table ref, int[] colmain, int[] colref, Index imain, Index iref, boolean cascade) throws java.sql.SQLException
- Constructor for foreign key constraints
Constraint
private Constraint()
| Method Detail |
setTableRows
private void setTableRows()
throws java.sql.SQLException
getName
HsqlName getName()
setName
private void setName(java.lang.String name, boolean isquoted)
- Changes constraint name.
getPkName
java.lang.String getPkName()
- probably a misnomer, but DatabaseMetaData.getCrossReference specifies
it this way (I suppose because most FKs are declared against the PK of
another table)
getFkName
java.lang.String getFkName()
- probably a misnomer, but DatabaseMetaData.getCrossReference specifies
it this way (I suppose because most FKs are declared against the PK of
another table)
getType
int getType()
- Method declaration
getMain
Table getMain()
- Method declaration
getMainIndex
Index getMainIndex()
getRef
Table getRef()
- Method declaration
getRefIndex
Index getRefIndex()
isCascade
boolean isCascade()
- Does (foreign key) constraint cascade on delete
getMainColumns
int[] getMainColumns()
- Method declaration
getRefColumns
int[] getRefColumns()
- Method declaration
isIndexFK
boolean isIndexFK(Index index)
- See if an index is part this constraint and the constraint is set for
a foreign key. Used for tests before dropping an index. (fredt@users)
isIndexUnique
boolean isIndexUnique(Index index)
- See if an index is part this constraint and the constraint is set for
a unique constraint. Used for tests before dropping an index.
(fredt@users)
isEquivalent
boolean isEquivalent(int[] col,
int type)
- Compares this with another constraint column set. This implementation
only checks UNIQUE constraints.
replaceTable
void replaceTable(Table oldt, Table newt, int colindex, int adjust) throws java.sql.SQLException
- Used to update constrains to reflect structural changes in a table.
checkInsert
void checkInsert(java.lang.Object[] row) throws java.sql.SQLException
- Checks for foreign key violation when inserting a row in the child
table.
checkDelete
private void checkDelete(java.lang.Object[] row) throws java.sql.SQLException
- Check if a row in the referenced (parent) table can be deleted. Used
only for UPDATE table statements. Checks for DELETE FROM table
statements are now handled by findFkRef() to support ON DELETE
CASCADE.
findFkRef
Node findFkRef(java.lang.Object[] row) throws java.sql.SQLException
- New method to find any referencing node (containing the row) for a
foreign key (finds row in child table). If ON DELETE CASCADE is
supported by this constraint, then the method finds the first row
among the rows of the table ordered by the index and doesn't throw.
Without ON DELETE CASCADE, the method attempts to finds any row that
exists, in which case it throws an exception. If no row is found,
null is returned.
(fredt@users)
checkUpdate
void checkUpdate(int[] col,
Result deleted,
Result inserted)
throws java.sql.SQLException
- Checks if updating a set of columns in a table row breaks the
referential integrity constraint.
|
|||||||||
| Home >> All >> org >> [ hsqldb overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.hsqldb.Constraint