NdbEventOperation Class Reference

Class of operations for getting change events from database. More...

#include <NdbEventOperation.hpp>

List of all members.

Public Types

enum  State { EO_CREATED, EO_EXECUTING, EO_DROPPED, EO_ERROR }

Public Member Functions

State getState ()
void mergeEvents (bool flag)
int execute ()
NdbRecAttrgetValue (const char *anAttrName, char *aValue=0)
NdbRecAttrgetPreValue (const char *anAttrName, char *aValue=0)
NdbBlobgetBlobHandle (const char *anAttrName)
NdbBlobgetPreBlobHandle (const char *anAttrName)
int isOverrun () const
bool isConsistent () const
NdbDictionary::Event::TableEvent getEventType () const
const bool tableNameChanged () const
const bool tableFrmChanged () const
const bool tableFragmentationChanged () const
const bool tableRangeListChanged () const
Uint64 getGCI () const
Uint32 getAnyValue () const
Uint64 getLatestGCI () const
struct NdbErrorgetNdbError () const

Private Member Functions

 NdbEventOperation (Ndb *theNdb, const char *eventName)
 ~NdbEventOperation ()
 NdbEventOperation (NdbEventOperationImpl &impl)
 NdbEventOperation (const NdbEventOperation &)
NdbEventOperationoperator= (const NdbEventOperation &)

Private Attributes

class NdbEventOperationImpl & m_impl


Detailed Description

Class of operations for getting change events from database.

Brief description on how to work with events:

For more info see: ndbapi_event.cpp

Known limitations:

Known issues:

Test status:

Useful API programs:

Note:
this is an inteface to viewing events that is subject to change

Member Enumeration Documentation

State of the NdbEventOperation object

Enumerator:
EO_CREATED  Created but execute() not called.
EO_EXECUTING  execute() called
EO_DROPPED  Waiting to be deleted, Object unusable.
EO_ERROR  An error has occurred. Object unusable.


Constructor & Destructor Documentation

NdbEventOperation::NdbEventOperation ( Ndb theNdb,
const char *  eventName 
) [private]

NdbEventOperation::~NdbEventOperation (  )  [private]

NdbEventOperation::NdbEventOperation ( NdbEventOperationImpl &  impl  )  [private]

NdbEventOperation::NdbEventOperation ( const NdbEventOperation  )  [private]


Member Function Documentation

int NdbEventOperation::execute (  ) 

Activates the NdbEventOperation to start receiving events. The changed attribute values may be retrieved after Ndb::nextEvent() has returned not NULL. The getValue() methods must be called prior to execute().

Returns:
0 if successful otherwise -1.

Uint32 NdbEventOperation::getAnyValue (  )  const

Retrieve the AnyValue of the latest retrieved event

Returns:
AnyValue

NdbBlob* NdbEventOperation::getBlobHandle ( const char *  anAttrName  ) 

These methods replace getValue/getPreValue for blobs. Each method creates a blob handle NdbBlob. The handle supports only read operations. See NdbBlob.

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

Query for occured event type.

Note:
Only valid after Ndb::nextEvent() has been called and returned a not NULL value
Returns:
type of event

Uint64 NdbEventOperation::getGCI (  )  const

Retrieve the GCI of the latest retrieved event

Returns:
GCI number

Uint64 NdbEventOperation::getLatestGCI (  )  const

Retrieve the complete GCI in the cluster (not necessarily associated with an event)

Returns:
GCI number

struct NdbError& NdbEventOperation::getNdbError (  )  const [read]

Get the latest error

Returns:
Error object.

NdbBlob* NdbEventOperation::getPreBlobHandle ( const char *  anAttrName  ) 

NdbRecAttr* NdbEventOperation::getPreValue ( const char *  anAttrName,
char *  aValue = 0 
)

See getValue().

State NdbEventOperation::getState (  ) 

Retrieve current state of the NdbEventOperation object

NdbRecAttr* NdbEventOperation::getValue ( const char *  anAttrName,
char *  aValue = 0 
)

Defines a retrieval operation of an attribute value. The NDB API allocate memory for the NdbRecAttr object that will hold the returned attribute value.

Note:
Note that it is the applications responsibility to allocate enough memory for aValue (if non-NULL). The buffer aValue supplied by the application must be aligned appropriately. The buffer is used directly (avoiding a copy penalty) only if it is aligned on a 4-byte boundary and the attribute size in bytes (i.e. NdbRecAttr::attrSize() times NdbRecAttr::arraySize() is a multiple of 4).

There are two versions, getValue() and getPreValue() for retrieving the current and previous value repectively.

This method does not fetch the attribute value from the database! The NdbRecAttr object returned by this method is not readable/printable before the execute() has been made and Ndb::nextEvent() has returned not NULL. If a specific attribute has not changed the corresponding NdbRecAttr will be in state UNDEFINED. This is checked by NdbRecAttr::isNULL() which then returns -1.

Parameters:
anAttrName Attribute name
aValue If this is non-NULL, then the attribute value will be returned in this parameter.
If NULL, then the attribute value will only be stored in the returned NdbRecAttr object.
Returns:
An NdbRecAttr object to hold the value of the attribute, or a NULL pointer (indicating error).

bool NdbEventOperation::isConsistent (  )  const

In the current implementation a nodefailiure may cause loss of events, in which case isConsistent() will return false

int NdbEventOperation::isOverrun (  )  const

void NdbEventOperation::mergeEvents ( bool  flag  ) 

See NdbDictionary::Event. Default is false.

NdbEventOperation& NdbEventOperation::operator= ( const NdbEventOperation  )  [private]

const bool NdbEventOperation::tableFragmentationChanged (  )  const

Check if table fragmentation has changed, for event TE_ALTER

const bool NdbEventOperation::tableFrmChanged (  )  const

Check if table frm has changed, for event TE_ALTER

const bool NdbEventOperation::tableNameChanged (  )  const

Check if table name has changed, for event TE_ALTER

const bool NdbEventOperation::tableRangeListChanged (  )  const

Check if table range partition list name has changed, for event TE_ALTER


Member Data Documentation

class NdbEventOperationImpl& NdbEventOperation::m_impl [private]


The documentation for this class was generated from the following file:

MySQL Cluster Database Blog

Based on MySQL Cluster 7.0.7.

This page is for information only and is not maintained by MySQL or Sun Microsystems - use at your own risk. For an upto date view of the API refer to the header files included with your MySQL Cluster distribution or check the MySQL Cluster API Developer Guide.