NdbEventOperation Class Reference

#include <NdbEventOperation.hpp>

List of all members.


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

Public Types

Public Member Functions


Member Enumeration Documentation

enum NdbEventOperation::State
 

State of the NdbEventOperation object

Enumeration values:
EO_CREATED  Created but execute() not called.
EO_EXECUTING  execute() called
EO_ERROR  An error has occurred. Object unusable.


Member Function Documentation

int NdbEventOperation::execute  ) 
 

Activates the NdbEventOperation to start receiving events. The changed attribute values may be retrieved after next() has returned a value greater than zero. The getValue() methods must be called prior to execute().

Returns:
0 if successful otherwise -1.

NdbDictionary::Event::TableEvent NdbEventOperation::getEventType  ) 
 

Query for occured event type.

Note:
Only valid after next() has been called and returned value >= 0
Returns:
type of event

Uint32 NdbEventOperation::getGCI  ) 
 

Retrieve the GCI of the latest retrieved event

Returns:
GCI number

Uint32 NdbEventOperation::getLatestGCI  ) 
 

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

Returns:
GCI number

const struct NdbError& NdbEventOperation::getNdbError  )  const
 

Get the latest error

Returns:
Error object.

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 next() has returned a value greater than zero. 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  ) 
 

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

int NdbEventOperation::next int *  pOverRun = 0  ) 
 

Retrieves event resultset if available, inserted into the NdbRecAttrs specified in getValue() and getPreValue(). To avoid polling for a resultset, one can use Ndb::pollEvents() which will wait on a mutex until an event occurs or the specified timeout occurs.

Returns:
>=0 if successful otherwise -1. Return value indicates number of available events. By sending pOverRun one may query for buffer overflow and *pOverRun will indicate the number of events that have overwritten.

number of available events, -1 on failure


Documentation generated Mon May 2 18:33:48 2005 from mysql source files.
© 2003-2004 MySQL AB