Top Description Fields Constructors Methods
org.apache.derby.iapi.sql.dictionary

public Class ForeignKeyConstraintDescriptor

extends KeyConstraintDescriptor
Class Inheritance
Imports
org.apache.derby.catalog.UUID, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.sql.StatementType, org.apache.derby.shared.common.sanity.SanityManager

A foreign key.

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
pack-priv ReferencedKeyConstraintDescriptor
referencedConstraintDescriptor

interface to this descriptor

  1. public ReferencedKeyConstraintDescriptor getReferencedConstraint() throws StandardException;
  2. public UUID getReferencedConstraintId() throws StandardException;
  3. public boolean isSelfReferencingFK() throws StandardException;
pack-priv UUID
Inherited from org.apache.derby.iapi.sql.dictionary.KeyConstraintDescriptor:
indexId

Constructor Summary

AccessConstructor and Description
protected
ForeignKeyConstraintDescriptor(DataDictionary
The data dictionary that this descriptor lives in
dataDictionary
,
TableDescriptor
The descriptor of the table the constraint is on
table
,
String
The name of the constraint.
constraintName
,
boolean
If the constraint can be deferred.
deferrable
,
boolean
If the constraint starts life deferred.
initiallyDeferred
,
int[]
columns in the foreign key
fkColumns
,
UUID
UUID of constraint
constraintId
,
UUID
The UUID for the backing index
indexId
,
SchemaDescriptor
The SchemaDescriptor for the constraint
schemaDesc
,
ReferencedKeyConstraintDescriptor
is referenced constraint descriptor
referencedConstraintDescriptor
,
boolean
is the constraint enforced?
enforced
,
int
The ON DELETE action rule
raDeleteRule
,
int
The ON UPDATE action rule
raUpdateRule
)

Constructor for a ForeignKeyConstraintDescriptor

pack-priv
ForeignKeyConstraintDescriptor(DataDictionary
The data dictionary that this descriptor lives in
dataDictionary
,
TableDescriptor
The descriptor of the table the constraint is on
table
,
String
The name of the constraint.
constraintName
,
boolean
If the constraint can be deferred.
deferrable
,
boolean
If the constraint starts life deferred.
initiallyDeferred
,
int[]
columns in the foreign key
fkColumns
,
UUID
UUID of constraint
constraintId
,
UUID
The UUID for the backing index
indexId
,
SchemaDescriptor
The SchemaDescriptor for the constraint
schemaDesc
,
UUID
is referenced constraint id
referencedConstraintId
,
boolean
true if this constraint is enforced
enforced
,
int
The ON DELETE action rule
raDeleteRule
,
int
The ON UPDATE action rule
raUpdateRule
)

Constructor for a ForeignKeyConstraintDescriptor

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

An identifier telling what type of descriptor it is (UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK).
getConstraintType
()

Implements abstract org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor.getConstraintType.

Gets an identifier telling what type of descriptor it is (UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK).

public int

Returns:

referential rule defined by the user during foreign key creattion for a delete (like CASCDE , RESTRICT ..etc)
getRaDeleteRule
()

Gets a referential action rule on a DELETE

public int

Returns:

referential rule defined by the user during foreign key creattion for an UPDATE (like CASCDE , RESTRICT ..etc)
getRaUpdateRule
()

Gets a referential action rule on a UPDATE

public ReferencedKeyConstraintDescriptor

Returns:

the constraint
getReferencedConstraint
()

Get the constraint that this FK references.

public UUID

Returns:

the constraint id
getReferencedConstraintId
()

Get the constraint id for the constraint that this FK references.

public boolean

Returns:

true/false
isSelfReferencingFK
()

Am I a self-referencing FK?

public boolean

Returns:

true/false
needsToFire
(int
the type of DML (StatementType.INSERT|StatementType.UPDATE|StatementType.DELETE)
stmtType
,
int[]
the columns modified, or null for all
modifiedCols
)

Implements abstract org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor.needsToFire.

Does this constraint need to fire on this type of DML?

Inherited from org.apache.derby.iapi.sql.dictionary.KeyConstraintDescriptor:
getConglomerateIdgetIndexConglomerateDescriptorgetIndexIdgetIndexUUIDStringhasBackingIndextoString

Field Detail

raDeleteRuleback to summary
pack-priv int raDeleteRule
raUpdateRuleback to summary
pack-priv int raUpdateRule
referencedConstraintDescriptorback to summary
pack-priv ReferencedKeyConstraintDescriptor referencedConstraintDescriptor

interface to this descriptor

  1. public ReferencedKeyConstraintDescriptor getReferencedConstraint() throws StandardException;
  2. public UUID getReferencedConstraintId() throws StandardException;
  3. public boolean isSelfReferencingFK() throws StandardException;
referencedConstraintIdback to summary
pack-priv UUID referencedConstraintId

Constructor Detail

ForeignKeyConstraintDescriptorback to summary
protected ForeignKeyConstraintDescriptor(DataDictionary dataDictionary, TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, int[] fkColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, ReferencedKeyConstraintDescriptor referencedConstraintDescriptor, boolean enforced, int raDeleteRule, int raUpdateRule)

Constructor for a ForeignKeyConstraintDescriptor

Parameters
dataDictionary:DataDictionary

The data dictionary that this descriptor lives in

table:TableDescriptor

The descriptor of the table the constraint is on

constraintName:String

The name of the constraint.

deferrable:boolean

If the constraint can be deferred.

initiallyDeferred:boolean

If the constraint starts life deferred.

fkColumns:int[]

columns in the foreign key

constraintId:UUID

UUID of constraint

indexId:UUID

The UUID for the backing index

schemaDesc:SchemaDescriptor

The SchemaDescriptor for the constraint

referencedConstraintDescriptor:ReferencedKeyConstraintDescriptor

is referenced constraint descriptor

enforced:boolean

is the constraint enforced?

raDeleteRule:int

The ON DELETE action rule

raUpdateRule:int

The ON UPDATE action rule

ForeignKeyConstraintDescriptorback to summary
pack-priv ForeignKeyConstraintDescriptor(DataDictionary dataDictionary, TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, int[] fkColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, UUID referencedConstraintId, boolean enforced, int raDeleteRule, int raUpdateRule)

Constructor for a ForeignKeyConstraintDescriptor

Parameters
dataDictionary:DataDictionary

The data dictionary that this descriptor lives in

table:TableDescriptor

The descriptor of the table the constraint is on

constraintName:String

The name of the constraint.

deferrable:boolean

If the constraint can be deferred.

initiallyDeferred:boolean

If the constraint starts life deferred.

fkColumns:int[]

columns in the foreign key

constraintId:UUID

UUID of constraint

indexId:UUID

The UUID for the backing index

schemaDesc:SchemaDescriptor

The SchemaDescriptor for the constraint

referencedConstraintId:UUID

is referenced constraint id

enforced:boolean

true if this constraint is enforced

raDeleteRule:int

The ON DELETE action rule

raUpdateRule:int

The ON UPDATE action rule

Method Detail

getConstraintTypeback to summary
public int getConstraintType()

Implements abstract org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor.getConstraintType.

Gets an identifier telling what type of descriptor it is (UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK).

Returns:int

An identifier telling what type of descriptor it is (UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK).

Annotations
@Override
getRaDeleteRuleback to summary
public int getRaDeleteRule()

Gets a referential action rule on a DELETE

Returns:int

referential rule defined by the user during foreign key creattion for a delete (like CASCDE , RESTRICT ..etc)

getRaUpdateRuleback to summary
public int getRaUpdateRule()

Gets a referential action rule on a UPDATE

Returns:int

referential rule defined by the user during foreign key creattion for an UPDATE (like CASCDE , RESTRICT ..etc)

getReferencedConstraintback to summary
public ReferencedKeyConstraintDescriptor getReferencedConstraint() throws StandardException

Get the constraint that this FK references. Will return either a primary key or a unique key constraint.

Returns:ReferencedKeyConstraintDescriptor

the constraint

Exceptions
StandardException:
on error
getReferencedConstraintIdback to summary
public UUID getReferencedConstraintId() throws StandardException

Get the constraint id for the constraint that this FK references. Will return either a primary key or a unique key constriant.

Returns:UUID

the constraint id

Exceptions
StandardException:
on error
isSelfReferencingFKback to summary
public boolean isSelfReferencingFK() throws StandardException

Am I a self-referencing FK? True if my referenced constraint is on the same table as me.

Returns:boolean

true/false

Exceptions
StandardException:
on error
needsToFireback to summary
public boolean needsToFire(int stmtType, int[] modifiedCols)

Implements abstract org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor.needsToFire.

Does this constraint need to fire on this type of DML? True if insert or update and columns intersect

Parameters
stmtType:int

the type of DML (StatementType.INSERT|StatementType.UPDATE|StatementType.DELETE)

modifiedCols:int[]

the columns modified, or null for all

Returns:boolean

true/false

Annotations
@Override