Documentation Home
MySQL Cluster API Developer Guide
Download this Manual
PDF (US Ltr) - 5.0Mb
PDF (A4) - 4.9Mb
EPUB - 1.9Mb
HTML Download (TGZ) - 1.9Mb
HTML Download (Zip) - 1.9Mb


2.3.8.2 ForeignKey Methods

Abstract

The sections that follow describe each of the public methods of the ForeignKey class.

2.3.8.2.1 ForeignKey()

Description.  Create either an entirely new foreign key reference, or a copy of an existing one.

Signature.  New instance:

ForeignKey
    (
      void
    )

Copy constructor:

ForeignKey
    ( 
      const ForeignKey&
    )

Parameters.  For a new instance: None.

For the copy constructor: A reference to an existing instance of ForeignKey.

Return value.  A new instance of ForeignKey.

2.3.8.2.2 ForeignKey::getName()

Description.  Retrieve the name of the ForeignKey instance for which the method is invoked.

Signature. 

const char* getName
    (
      void
    ) const

Parameters.  None.

Return value.  The name of the ForeignKey.

2.3.8.2.3 ForeignKey::getParentTable()

Description.  Retrieve the parent table of the ForeignKey instance for which the method is invoked.

Signature. 

const char* getParentTable
      (
        void
      ) const

Parameters.  None.

Return value.  A pointer to the parent table of the ForeignKey.

2.3.8.2.4 ForeignKey::getChildTable()

Description.  Retrieve the child table of the ForeignKey instance for which the method is invoked.

Signature. 

const char* getChildTable
      (
        void
      ) const

Parameters.  None.

Return value.  A pointer to the child table of this ForeignKey.

2.3.8.2.5 ForeignKey::getParentColumnCount()

Description.  Retrieve the number of columns in the parent table of this ForeignKey.

Signature. 

unsigned getParentColumnCount
      (
        void
      ) const

Parameters.  None.

Return value.  The number of columns in the parent table.

2.3.8.2.6 ForeignKey::getChildColumnCount()

Description.  Retrieve the number of columns in the child table of this ForeignKey.

Signature. 

unsigned getChildColumnCount
      (
        void
      ) const

Parameters.  None.

Return value.  The number of columns in the child table.

2.3.8.2.7 ForeignKey::getParentIndex()

Description.  Returns 0 if the child table refers to the parent table's primary key.

Signature. 

const char* getParentIndex
    (
      void
    ) const

Parameters.  None.

Return value.  See description.

2.3.8.2.8 ForeignKey::getChildIndex()

Description.  Return 0 if child references are resolved using the child table's primary key.

Signature. 

const char* getChildIndex
    (
      void
    ) const

Parameters.  None.

Return value.  See description.

2.3.8.2.9 ForeignKey::getParentColumnNo()

Description.  This method gets the sequence number of a foreign key column in the parent table for a given index. See the documentation for Column::getColumnNo() for information about handling columns in the NDB API.

Signature. 

int getParentColumnNo
    (
      unsigned no
    ) const

Parameters.  None.

Return value.  The sequence number of the column.

2.3.8.2.10 ForeignKey::getChildColumnNo()

Description.  This method gets the sequence number of a foreign key column in the child table for a given index. See the documentation for Column::getColumnNo() for information about handling columns in the NDB API.

Signature. 

int getChildColumnNo
    (
      unsigned no
    ) const

Parameters.  None.

Return value.  The sequence number of the column.

2.3.8.2.11 ForeignKey::getOnUpdateAction()

Description.  Get the foreign key's ON UPDATE action. This is a ForeignKey::FkAction and has one of the values NoAction, Restrict, Cascade, or SetNull.

Signature. 

FkAction getOnUpdateAction
    (
      void
    ) const

Parameters.  None.

Return value.  The sequence number of the column.

2.3.8.2.12 ForeignKey::getOnDeleteAction()

Description.  Get the foreign key's ON DELETE action. This is a ForeignKey::FkAction and has one of the values NoAction, Restrict, Cascade, or SetNull.

Signature. 

FkAction getOnDeleteAction
    (
      void
    ) const

Parameters.  None.

Return value.  The sequence number of the column.

2.3.8.2.13 ForeignKey::setName()

Description.  Set the name of the ForeignKey instance for which the method is invoked.

Signature. 

void setName
    (
      const char*
    )

Parameters.  The name of the ForeignKey.

Return value.  None.

2.3.8.2.14 ForeignKey::setParent()

Description.  Set the parent table of a ForeignKey, given a reference to the table, and optionally, an index to use as the foreign key.

Signature. 

void setParent
    (
      const Table&, 
      const Index* index = 0,
      const Column* cols[] = 0
    )

Parameters.  A reference to a Table. Optionally, an index using the indicated column or columns.

Return value.  None.

2.3.8.2.15 ForeignKey::setChild()

Description.  Set the child table of a ForeignKey, given a reference to the table, and optionally, an index to use as the foreign key.

Signature. 

void setChild
    (
      const Table&, 
      const Index* index = 0,
      const Column* cols[] = 0
    )

Parameters.  A reference to a Table. Optionally, an index using the indicated column or columns.

Return value.  None.

2.3.8.2.16 ForeignKey::setOnUpdateAction()

Description.  Set the foreign key's ON UPDATE action.

Signature. 

void setOnUpdateAction
  (
    FkAction
  )

Parameters.  The ON UPDATE action to be performed. This must be a ForeignKey::FkAction having one of the values NoAction, Restrict, Cascade, or SetNull.

Return value.  None

2.3.8.2.17 ForeignKey::setOnDeleteAction()

Description.  Set the foreign key's ON DELETE action.

Signature. 

void setOnUpdateAction
  (
    FkAction
  )

Parameters.  The ON UPDATE action to be performed, of type ForeignKey::FkAction. Must be one of the values NoAction, Restrict, Cascade, or SetNull.

Return value.  None

2.3.8.2.18 ForeignKey::getObjectStatus()

Description.  Get the object status (see Section 2.3.31.1.3, “The Object::Status Type”) for this ForeignKey object.

Signature. 

virtual Object::Status getObjectStatus
    (
      void
    ) const

Parameters.  None.

Return value.  The ForeignKey object's status, as a value of type Object::Status. See this type's documentation for possible values and their interpretation.

2.3.8.2.19 ForeignKey::getObjectId()

Description.  Get the object ID (see Section 2.3.31.2.1, “Object::getObjectId()”) for this ForeignKey object.

Signature. 

virtual int getObjectId
    (
      void
    ) const

Parameters.  None.

Return value.  The ForeignKey object's ID, as returned by Object::getObjectId().

2.3.8.2.20 ForeignKey::getObjectVersion()

Description.  Get the object version (see Section 2.3.31.2.3, “Object::getObjectVersion()”) for this ForeignKey object.

Signature. 

virtual int getObjectVersion
    (
      void
    ) const

Parameters.  None.

Return value.  The ForeignKey object's version number (an integer), as returned by Object::getObjectVersion().


User Comments
Sign Up Login You must be logged in to post a comment.