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::attrSize() times
NdbRecAttr::arraySize()) is a multiple of
4.
getValue() retrieves the current value. Use
getPreValue() for retrieving the previous
value. See
Section 4.11.2.4, “NdbEventOperation::getPreValue()”.
Signature.
NdbRecAttr* getValue
(
const char* name,
char* value = 0
)
Parameters. This method takes two parameters:
The name of the attribute (as
a constant character pointer).
A pointer to a value:
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. See
Section 4.16, “The NdbRecAttr Class”.
