2.3.7 The ForeignKey Class

2.3.7.1 The ForeignKey::FkAction Type
2.3.7.2 ForeignKey Methods

Abstract

This class represents a foreign key on an NDB table. It was added to the NDB API in MySQL Cluster NDB 7.3.

Parent class.  Object

Child classes.  None.

Methods.  The following table lists the public methods of the ForeignKey class and the purpose or use of each method:

MethodPurpose / Use
ForeignKey()Class constructor
~ForeignKey()Class destructor
getName()Get the foreign key's name
getParentTable()Get the foreign key's parent table
getChildTable()Get the foreign key's child table
getParentColumnCount()Get the number of columns in the parent table
getChildColumnCount()Get the number of columns in the child table
getParentColumnNo()Get the column number in the parent table
getChildColumnNo()Get the column number in the child table
getParentIndex()Returns 0 if key points to parent table's primary key
getChildIndex()Returns 0 if child references resolved using child table's primary key
getOnUpdateAction()Get the foreign's key update action (FkAction)
getDeleteAction()Get the foreign key's delete action (FkAction)
setName()Set the foreign key's name
setParent()Set the foreign key's parent table
setChild()Set a foreign key's child table
setOnUpdateAction()Set the foreign's key update action (FkAction)
setDeleteAction()Set the foreign key's delete action (FkAction)
getObjectStatus()Get the object status
getObjectId()Get the object ID
getObjectVersion()Get the object version

For a detailed discussion of each of these methods, see Section 2.3.7.2, “ForeignKey Methods”.

Types.  The ForeignKey class has one public type, the FkAction type.

This diagram shows all public members of the ForeignKey class:

Public members of the ForeignKey class.