NdbRecAttr Class Reference
#include <NdbRecAttr.hpp>
List of all members.
Detailed Description
Contains value of an attribute.
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();
For more examples, see ndbapi_simple.cpp.
- Note:
- The NdbRecAttr object is instantiated with its value when NdbTransaction::execute is called. Before this, the value is undefined. (NdbRecAttr::isNULL can be used to check if the value is defined or not.) This means that an NdbRecAttr object only has valid information between the time of calling NdbTransaction::execute and the time of Ndb::closeTransaction. The value of the null indicator is -1 until the NdbTransaction::execute method have been called.
For simple types, there are methods which directly getting the value from the NdbRecAttr object.
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.
- Note:
- Variable-sized attributes are not yet supported.
Public Member Functions
|
|
|
Constructor & Destructor Documentation
|
Destructor
- Note:
- You should only delete RecAttr-copies, i.e. objects that has been cloned.
|
Member Function Documentation
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.
- Note:
- The memory is released by NDB API.
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.
- Returns:
- Pointer to attribute value.
|
Uint32 NdbRecAttr::arraySize |
( |
|
) |
const |
|
|
Get array size of attribute. For variable-sized arrays this method returns the size of the attribute read.
- Returns:
- array size in 32 unsigned int.
|
Uint32 NdbRecAttr::attrSize |
( |
|
) |
const |
|
|
Get attribute (element) size in bytes.
- Note:
- For arrays, the method only gives the size of an element. The total attribute size is calculated by multiplying this value with the value returned by NdbRecAttr::arraySize.
- Returns:
- Attribute size in 32 bit unsigned int.
|
char NdbRecAttr::char_value |
( |
|
) |
const |
|
|
Get value stored in NdbRecAttr object.
- Returns:
- Char value.
|
|
Make a copy of RecAttr object including all data.
- Note:
- Copy needs to be deleted by application program.
|
double NdbRecAttr::double_value |
( |
|
) |
const |
|
|
Get value stored in NdbRecAttr object.
- Returns:
- Double value.
|
float NdbRecAttr::float_value |
( |
|
) |
const |
|
|
Get value stored in NdbRecAttr object.
- Returns:
- Float value.
|
|
Get type of column - Returns:
- Data type of the column
|
Int32 NdbRecAttr::int32_value |
( |
|
) |
const |
|
|
Get value stored in NdbRecAttr object.
- Returns:
- 32 bit int value.
|
Int64 NdbRecAttr::int64_value |
( |
|
) |
const |
|
|
Get value stored in NdbRecAttr object.
- Returns:
- 64 bit long value.
|
int NdbRecAttr::isNULL |
( |
|
) |
const |
|
|
Check if attribute value is NULL.
- Returns:
- -1 = Not defined (Failure or NdbTransaction::execute not yet called).
0 = Attribute value is defined, but not equal to NULL.
1 = Attribute value is defined and equal to NULL.
|
short NdbRecAttr::short_value |
( |
|
) |
const |
|
|
Get value stored in NdbRecAttr object.
- Returns:
- Short value.
|
Uint32 NdbRecAttr::u_32_value |
( |
|
) |
const |
|
|
Get value stored in NdbRecAttr object.
- Returns:
- 32 bit unsigned value.
|
Uint64 NdbRecAttr::u_64_value |
( |
|
) |
const |
|
|
Get value stored in NdbRecAttr object.
- Returns:
- 64 bit unsigned value.
|
Uint8 NdbRecAttr::u_char_value |
( |
|
) |
const |
|
|
Get value stored in NdbRecAttr object.
- Returns:
- Unsigned char value.
|
Uint16 NdbRecAttr::u_short_value |
( |
|
) |
const |
|
|
Get value stored in NdbRecAttr object.
- Returns:
- Unsigned short value.
|
Documentation generated Wed May 4 09:45:01 2005 from mysql source files.
© 2003-2004
MySQL AB