Documentation Home
MySQL NDB Cluster API Developer Guide
Download this Manual

2.3.6 The Event Class


This section discusses the Event class, its methods and defined types.

Parent class.  NdbDictionary

Child classes.  None

Description.  This class represents a database event in an NDB Cluster.

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

Method Purpose / Use
Event() Class constructor
~Event() Destructor
addEventColumn() Adds a column on which events should be detected
addEventColumns() Adds multiple columns on which events should be detected
addTableEvent() Adds the type of event that should be detected
getDurability() Gets the event's durability
getEventColumn() Gets a column for which an event is defined
getName() Gets the event's name
getNoOfEventColumns() Gets the number of columns for which an event is defined
getObjectId() Gets the event's object ID
getObjectStatus() Gets the event's object status
getObjectVersion() Gets the event's object version
getReport() Gets the event's reporting options
getTable() Gets the Table object on which the event is defined
getTableEvent() Checks whether an event is to be detected
getTableName() Gets the name of the table on which the event is defined
mergeEvents() Sets the event's merge flag
setDurability() Sets the event's durability
setName() Sets the event's name
setReport() The the event's reporting options
setTable() Sets the Table object on which the event is defined

Improved Event API (NDB 7.4.3 and later).  NDB 7.4.3 introduces an epoch-driven Event API that supercedes the earlier GCI-based model. The new version of the API also simplifies error detection and handling. These changes are realized in the NDB API by implementing a number of new methods for Ndb and NdbEventOperation, deprecating several other methods of both classes, and adding new type values to TableEvent.

Some of the new methods directly replace or stand in for deprecated methods, but not all of the deprecated methods map to new ones, some of which are entirely new. Old (deprecated) methods are shown in the first column of the following table, and new methods in the second column; old methods corresponding to new methods are shown in the same row.

Error handling using the new API is accomplished by checking the value returned from getEventType2(), and is no longer handled using the methods hasError() and clearError(), which are now deprecated and subject to removal in a future release of NDB Cluster. In support of this change, the range of possible TableEvent types has been expanded by those listed here:

  • TE_EMPTY: Empty epoch

  • TE_INCONSISTENT: Inconsistent epoch; missing data or overflow

  • TE_OUT_OF_MEMORY: Inconsistent data; event buffer out of memory or overflow

The result of these changes is that, in NDB 7.4.3 and later, you can check for errors while checking a table event's type, as shown here:

NdbDictionary::Event::TableEvent* error_type = 0;
NdbEventOperation* pOp = nextEvent2();

if (pOp->isErrorEpoch(error_type)
  switch (error_type)
      // Handle error/inconsistent epoch...

    case TE_OUT_OF_MEMORY :
      // Handle error/inconsistent data...
    //  ...

For more information, see the detailed descriptions for the Ndb and NdbEventOperation methods shown in the table previously, as well as Section, “Event::TableEvent”.

Types.  These are the public types of the Event class:

Type Purpose / Use
TableEvent() Represents the type of a table event
EventDurability() Specifies an event's scope, accessibility, and lifetime
EventReport() Specifies the reporting option for a table event

Class diagram.  This diagram shows all the available methods and enumerated types of the Event class:

Figure 2.5 NdbDictionary::Object::Event

Public methods and enumerated types of the Event class.

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