Documentation Home
MySQL NDB Cluster API Developer Guide
Download this Manual 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.


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.


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


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.