#include <NdbRecAttr.hpp>
NdbRecAttr objects are used to store the attribute value after retrieving the value from the NDB Cluster using the method NdbOperation::getValue. The objects are allocated by the NDB API. An example application program follows:
MyRecAttr = MyOperation->getValue("ATTR2", NULL); if (MyRecAttr == NULL) goto error; if (MyTransaction->execute(Commit) == -1) goto error; ndbout << MyRecAttr->u_32_value();
To get a reference to the value, there are two methods: NdbRecAttr::aRef (memory is released by NDB API) and NdbRecAttr::getAttributeObject (memory must be released by application program). The two methods may return different pointers.
There are also methods to check attribute type, attribute size and array size. The method NdbRecAttr::arraySize returns the number of elements in the array (where each element is of size given by NdbRecAttr::attrSize). The NdbRecAttr::arraySize method is needed when reading variable-sized attributes.
NdbRecAttr::~NdbRecAttr | ( | ) |
Destructor
NdbDictionary::Column::Type NdbRecAttr::getType | ( | ) | const |
Get type of column
Uint32 NdbRecAttr::attrSize | ( | ) | const |
Get attribute (element) size in bytes.
Uint32 NdbRecAttr::arraySize | ( | ) | const |
Get array size of attribute. For variable-sized arrays this method returns the size of the attribute read.
int NdbRecAttr::isNULL | ( | ) | const |
Check if attribute value is NULL.
Int64 NdbRecAttr::int64_value | ( | ) | const |
Int32 NdbRecAttr::int32_value | ( | ) | const |
Int32 NdbRecAttr::medium_value | ( | ) | const |
short NdbRecAttr::short_value | ( | ) | const |
char NdbRecAttr::char_value | ( | ) | const |
Int8 NdbRecAttr::int8_value | ( | ) | const |
Uint64 NdbRecAttr::u_64_value | ( | ) | const |
Uint32 NdbRecAttr::u_32_value | ( | ) | const |
Uint32 NdbRecAttr::u_medium_value | ( | ) | const |
Uint16 NdbRecAttr::u_short_value | ( | ) | const |
Uint8 NdbRecAttr::u_char_value | ( | ) | const |
Uint8 NdbRecAttr::u_8_value | ( | ) | const |
float NdbRecAttr::float_value | ( | ) | const |
double NdbRecAttr::double_value | ( | ) | const |
char* NdbRecAttr::aRef | ( | ) | const |
Get reference to attribute value.
Returns a char*-pointer to the value. The pointer is aligned appropriately for the data type. The memory is released when Ndb::closeTransaction is executed for the transaction which read the value.
The pointer to the attribute value stored in an NdbRecAttr object (i.e. the pointer returned by aRef) is constant. This means that this method can be called anytime after NdbOperation::getValue has been called.
NdbRecAttr* NdbRecAttr::clone | ( | ) | const |
Make a copy of RecAttr object including all data.