Abstract
The section describes the NdbRecAttr
class and
its public methods.
Parent class. None
Child classes. None
Description.
NdbRecAttr
contains the value of an attribute.
An NdbRecAttr
object is used to store an
attribute value after it has been retrieved the
NDB
Cluster using the
NdbOperation::getValue()
. This object is
allocated by the NDB API. A brief example is shown here:
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 Section 2.4.1, “Using Synchronous Transactions”.
An NdbRecAttr
object is instantiated with its
value when NdbTransaction::execute()
is
invoked. Prior to this, the value is undefined. (Use
NdbRecAttr::isNULL()
to check whether the value
is defined.) This means that an NdbRecAttr
object has valid information only between the times that
NdbTransaction::execute()
and
Ndb::closeTransaction()
are called. The value
of the NULL
indicator is -1
until the NdbTransaction::execute()
method is
invoked.
Methods.
NdbRecAttr
has a number of methods for
retrieving values of various simple types directly from an
instance of this class.
It is also possible to obtain a reference to the value regardless
of its actual type, by using
NdbRecAttr::aRef()
; however, you should be
aware that this is not type-safe, and requires a cast from the
user. See Section 2.3.16.1.19, “NdbRecAttr::aRef()
”, for more
information.
The following table lists all of the public methods of this class and the purpose or use of each method:
Method | Purpose / Use |
---|---|
getColumn() |
Gets the column to which the attribute belongs |
getType() |
Gets the attribute's type (Column::Type ) |
get_size_in_bytes() |
Gets the size of the attribute, in bytes |
isNULL() |
Tests whether the attribute is NULL
|
int64_value() |
Retrieves a Bigint attribute value, as a 64-bit
integer |
int32_value() |
Retrieves an Int attribute value, as a 32-bit integer |
medium_value() |
Retrieves a Mediumint attribute value, as a 32-bit
integer |
short_value() |
Retrieves a Smallint attribute value, as a 16-bit
integer |
char_value() |
Retrieves a Char attribute value |
int8_value() |
Retrieves a Tinyint attribute value, as an 8-bit
integer |
u_64_value() |
Retrieves a Bigunsigned attribute value, as an
unsigned 64-bit integer |
u_32_value() |
Retrieves an Unsigned attribute value, as an unsigned
32-bit integer |
u_medium_value() |
Retrieves a Mediumunsigned attribute value, as an
unsigned 32-bit integer |
u_short_value() |
Retrieves a Smallunsigned attribute value, as an
unsigned 16-bit integer |
u_char_value() |
Retrieves a Char attribute value, as an unsigned
char
|
u_8_value() |
Retrieves a Tinyunsigned attribute value, as an
unsigned 8-bit integer |
float_value() |
Retrieves a Float attribute value, as a float (4
bytes) |
double_value() |
Retrieves a Double attribute value, as a double (8
bytes) |
aRef() |
Gets a pointer to the attribute value |
clone() |
Makes a deep copy of the RecAttr object |
~NdbRecAttr() |
Destructor method |
For detailed descriptions, signatures, and examples of use for each
of these methods, see Section 2.3.16.1, “NdbRecAttr
Methods”.
Types.
The NdbRecAttr
class defines no public types.
Class diagram.
This diagram shows all the available methods of the
NdbRecAttr
class: