2.3.20.2 NdbEventOperation Methods

2.3.20.2.1 NdbEventOperation::execute()
2.3.20.2.2 NdbEventOperation::getBlobHandle()
2.3.20.2.3 NdbEventOperation::getEventType()
2.3.20.2.4 NdbEventOperation::getGCI()
2.3.20.2.5 NdbEventOperation::getLatestGCI()
2.3.20.2.6 NdbEventOperation::getNdbError()
2.3.20.2.7 NdbEventOperation::getPreBlobHandle()
2.3.20.2.8 NdbEventOperation::getPreValue()
2.3.20.2.9 NdbEventOperation::getState()
2.3.20.2.10 NdbEventOperation::getValue()
2.3.20.2.11 NdbEventOperation::isConsistent()
2.3.20.2.12 NdbEventOperation::mergeEvents()
2.3.20.2.13 NdbEventOperation::tableFragmentationChanged()
2.3.20.2.14 NdbEventOperation::tableFrmChanged()
2.3.20.2.15 NdbEventOperation::tableNameChanged()
2.3.20.2.16 NdbEventOperation::tableRangeListChanged()

Abstract

This section contains definitions and descriptions of the public methods of the NdbEventOperation class.

2.3.20.2.1 NdbEventOperation::execute()

Description.  Activates the NdbEventOperation, so that it can begin receiving events. Changed attribute values may be retrieved after Ndb::nextEvent() has returned a value other than NULL.

One of getValue(), getPreValue(), getBlobValue(), or getPreBlobValue() must be called before invoking execute().

Important

Before attempting to use this method, you should have read the explanations provided in Section 2.3.15.1.16, “Ndb::nextEvent(), and Section 2.3.20.2.10, “NdbEventOperation::getValue(). Also see Section 2.3.20, “The NdbEventOperation Class”.

Signature. 

int execute
    (
      void
    )

Parameters.  None.

Return value.  This method returns 0 on success and -1 on failure.

2.3.20.2.2 NdbEventOperation::getBlobHandle()

Description.  This method is used in place of getValue() for blob attributes. The blob handle (NdbBlob) returned by this method supports read operations only.

Note

To obtain the previous value for a blob attribute, use getPreBlobHandle().

Signature. 

NdbBlob* getBlobHandle
    (
      const char* name
    )

Parameters.  The name of the blob attribute.

Return value.  A pointer to an NdbBlob object.

2.3.20.2.3 NdbEventOperation::getEventType()

Description.  This method is used to obtain the event's type (TableEvent).

Signature. 

NdbDictionary::Event::TableEvent getEventType
    (
      void
    ) const

Parameters.  None.

Return value.  A TableEvent value.

2.3.20.2.4 NdbEventOperation::getGCI()

Description.  This method retrieves the GCI for the most recently retrieved event.

Signature. 

Uint64 getGCI
    (
      void
    ) const

Parameters.  None.

Return value.  The global checkpoint index of the most recently retrieved event (an integer).

2.3.20.2.5 NdbEventOperation::getLatestGCI()

Description.  This method retrieves the most recent GCI.

Beginning with MySQL Cluster NDB 6.2.5, this method actually returns the latest epoch number, and all references to GCIs in the documentation for this method when using this or a later MySQL Cluster NDB version should be taken to mean epoch numbers instead. This is a consequence of the implementation for micro-CGPs.

Note

The GCI obtained using this method is not necessarily associated with an event.

Signature. 

Uint64 getLatestGCI
    (
      void
    ) const

Parameters.  None.

Return value.  The index of the latest global checkpoint, an integer.

2.3.20.2.6 NdbEventOperation::getNdbError()

Description.  This method retrieves the most recent error.

Signature. 

const struct NdbError& getNdbError
    (
      void
    ) const

Parameters.  None.

Return value.  A reference to an NdbError structure.

2.3.20.2.7 NdbEventOperation::getPreBlobHandle()

Description.  This function is the same as getBlobHandle(), except that it is used to access the previous value of the blob attribute. See Section 2.3.20.2.2, “NdbEventOperation::getBlobHandle().

Signature. 

NdbBlob* getPreBlobHandle
  (
    const char* name
  )

Parameters.  The name of the blob attribute.

Return value.  A pointer to an NdbBlob.

2.3.20.2.8 NdbEventOperation::getPreValue()

Description.  This method performs identically to getValue(), except that it is used to define a retrieval operation of an attribute's previous value rather than the current value. See Section 2.3.20.2.10, “NdbEventOperation::getValue(), for details.

Signature. 

NdbRecAttr* getPreValue
    (
      const char* name,
      char*       value = 0
    )

Parameters.  This method takes the two parameters listed here:

  • The name of the attribute (as a constant character pointer).

  • A pointer to a value, such that:

    • If the attribute value is not NULL, then the attribute value is returned in this parameter.

    • If the attribute value is NULL, then the attribute value is stored only in the NdbRecAttr object returned by this method.

    See value Buffer Memory Allocation, for more information regarding this parameter.

Return value.  An NdbRecAttr object to hold the value of the attribute, or a NULL pointer indicating that an error has occurred.

2.3.20.2.9 NdbEventOperation::getState()

Description.  This method gets the event operation's current state.

Signature. 

State getState
    (
      void
    )

Parameters.  None.

Return value.  A State value. See Section 2.3.20.1, “The NdbEventOperation::State Type”.

2.3.20.2.10 NdbEventOperation::getValue()

Description.  This method defines the retrieval of an attribute value. The NDB API allocates memory for the NdbRecAttr object that is to hold the returned attribute value.

Important

This method does not fetch the attribute value from the database, and the NdbRecAttr object returned by this method is not readable or printable before calling the execute() method and Ndb::nextEvent() has returned a non-NULL value.

If a specific attribute has not changed, the corresponding NdbRecAttr will be in the state UNDEFINED. This can be checked by using NdbRecAttr::isNULL() which in such cases returns -1.

value Buffer Memory Allocation.  It is the application's responsibility to allocate sufficient memory for the value buffer (if not NULL), and this buffer must be aligned appropriately. The buffer is used directly (thus avoiding a copy penalty) only if it is aligned on a 4-byte boundary and the attribute size in bytes (calculated as NdbRecAttr::get_size_in_bytes()) is a multiple of 4.

Note

getValue() retrieves the current value. Use getPreValue() for retrieving the previous value.

Signature. 

NdbRecAttr* getValue
    (
      const char* name,
      char*       value = 0
    )

Parameters.  This method takes the two parameters listed here:

  • The name of the attribute (as a constant character pointer).

  • A pointer to a value, such that:

    • If the attribute value is not NULL, then the attribute value is returned in this parameter.

    • If the attribute value is NULL, then the attribute value is stored only in the NdbRecAttr object returned by this method.

    See value Buffer Memory Allocation, for more information regarding this parameter.

Return value.  An NdbRecAttr object to hold the value of the attribute, or a NULL pointer indicating that an error has occurred.

2.3.20.2.11 NdbEventOperation::isConsistent()

Description.  This method is used to determine whether event loss has taken place following the failure of a node.

Signature. 

bool isConsistent
    (
      void
    ) const

Parameters.  None.

Return value.  If event loss has taken place, then this method returns false; otherwise, it returns true.

2.3.20.2.12 NdbEventOperation::mergeEvents()

Description.  This method is used to set the merge events flag. For information about event merging, see Section 2.3.6.2.16, “Event::mergeEvents().

Note

The merge events flag is false by default.

Signature. 

void mergeEvents
    (
      bool flag
    )

Parameters.  A Boolean flag.

Return value.  None.

2.3.20.2.13 NdbEventOperation::tableFragmentationChanged()

Description.  This method is used to test whether a table's fragmentation has changed in connection with a TE_ALTER event. (See Section 2.3.6.1.1, “The Event::TableEvent Type”.)

Signature. 

bool tableFragmentationChanged
    (
      void
    ) const

Note

Prior to MySQL Cluster NDB 7.1.0, this method used const bool as its return type (see Bug #44840).

Parameters.  None.

Return value.  Returns true if the table's fragmentation has changed; otherwise, the method returns false.

2.3.20.2.14 NdbEventOperation::tableFrmChanged()

Description.  Use this method to determine whether a table .FRM file has changed in connection with a TE_ALTER event. (See Section 2.3.6.1.1, “The Event::TableEvent Type”.)

Signature. 

bool tableFrmChanged
    (
      void
    ) const

Note

Prior to MySQL Cluster NDB 7.1.0, this method used const bool as its return type (see Bug #44840)-

Parameters.  None.

Return value.  Returns true if the table .FRM file has changed; otherwise, the method returns false.

2.3.20.2.15 NdbEventOperation::tableNameChanged()

Description.  This method tests whether a table name has changed as the result of a TE_ALTER table event. (See Section 2.3.6.1.1, “The Event::TableEvent Type”.)

Signature. 

bool tableNameChanged
    (
      void
    ) const

Note

Prior to MySQL Cluster NDB 7.1.0, this method used const bool as its return type (see Bug #44840).

Parameters.  None.

Return value.  Returns true if the name of the table has changed; otherwise, the method returns false.

2.3.20.2.16 NdbEventOperation::tableRangeListChanged()

Description.  Use this method to check whether a table range partition list name has changed in connection with a TE_ALTER event.

Signature. 

bool tableRangeListChanged
    (
      void
    ) const

Note

Prior to MySQL Cluster NDB 7.1.0, this method used const bool as its return type (see Bug #44840).

Parameters.  None.

Return value.  This method returns true if range or list partition name has changed; otherwise it returns false.