MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbRecAttr Class Reference

Contains value of an attribute. More...

#include <NdbRecAttr.hpp>

Public Member Functions

NdbRecAttrclone () const
 ~NdbRecAttr ()
const NdbRecAttrnext () const
Getting meta information
const NdbDictionary::ColumngetColumn () const
NdbDictionary::Column::Type getType () const
Uint32 get_size_in_bytes () const
Getting stored value
int isNULL () const
Int64 int64_value () const
Int32 int32_value () const
Int32 medium_value () const
short short_value () const
char char_value () const
Int8 int8_value () const
Uint64 u_64_value () const
Uint32 u_32_value () const
Uint32 u_medium_value () const
Uint16 u_short_value () const
Uint8 u_char_value () const
Uint8 u_8_value () const
float float_value () const
double double_value () const
Getting reference to stored value
char * aRef () const

Friends

class NdbOperation
class NdbScanOperation
class NdbIndexScanOperation
class NdbEventOperationImpl
class NdbReceiver
class Ndb
class NdbQueryOperationImpl
struct Ndb_free_list_t< NdbRecAttr >
class NdbOut & operator<< (class NdbOut &, const class AttributeS &)

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.

Definition at line 74 of file NdbRecAttr.hpp.

Constructor & Destructor Documentation

NdbRecAttr::~NdbRecAttr ( )

Destructor

Note
You should only delete RecAttr-copies, i.e. objects that has been cloned.

Definition at line 32 of file NdbRecAttr.cpp.

Here is the call graph for this function:

Member Function Documentation

char * NdbRecAttr::aRef ( ) const
inline

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.

Definition at line 423 of file NdbRecAttr.hpp.

char NdbRecAttr::char_value ( ) const
inline

Get value stored in NdbRecAttr object.

Returns
Char value.

Definition at line 338 of file NdbRecAttr.hpp.

NdbRecAttr * NdbRecAttr::clone ( ) const

Make a copy of RecAttr object including all data.

Note
Copy needs to be deleted by application program.

Definition at line 113 of file NdbRecAttr.cpp.

Here is the caller graph for this function:

double NdbRecAttr::double_value ( ) const

Get value stored in NdbRecAttr object.

Returns
Double value.

Definition at line 218 of file NdbRecAttr.cpp.

float NdbRecAttr::float_value ( ) const

Get value stored in NdbRecAttr object.

Returns
Float value.

Definition at line 210 of file NdbRecAttr.cpp.

Uint32 NdbRecAttr::get_size_in_bytes ( ) const
inline

Get attribute (element) size in bytes.

Definition at line 104 of file NdbRecAttr.hpp.

NdbDictionary::Column::Type NdbRecAttr::getType ( ) const
inline

Get type of column

Returns
Data type of the column

Definition at line 312 of file NdbRecAttr.hpp.

Here is the call graph for this function:

Int32 NdbRecAttr::int32_value ( ) const
inline

Get value stored in NdbRecAttr object.

Returns
32 bit int value.

Definition at line 324 of file NdbRecAttr.hpp.

Int64 NdbRecAttr::int64_value ( ) const

Get value stored in NdbRecAttr object.

Returns
64 bit long value.

Definition at line 194 of file NdbRecAttr.cpp.

Int8 NdbRecAttr::int8_value ( ) const
inline

Get value stored in NdbRecAttr object.

Returns
Int8 value.

Definition at line 345 of file NdbRecAttr.hpp.

int NdbRecAttr::isNULL ( ) const
inline

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.

Definition at line 452 of file NdbRecAttr.hpp.

Int32 NdbRecAttr::medium_value ( ) const

Get value stored in NdbRecAttr object.

Returns
Medium value.

Definition at line 226 of file NdbRecAttr.cpp.

short NdbRecAttr::short_value ( ) const
inline

Get value stored in NdbRecAttr object.

Returns
Short value.

Definition at line 331 of file NdbRecAttr.hpp.

Uint32 NdbRecAttr::u_32_value ( ) const
inline

Get value stored in NdbRecAttr object.

Returns
32 bit unsigned value.

Definition at line 352 of file NdbRecAttr.hpp.

Uint64 NdbRecAttr::u_64_value ( ) const

Get value stored in NdbRecAttr object.

Returns
64 bit unsigned value.

Definition at line 202 of file NdbRecAttr.cpp.

Uint8 NdbRecAttr::u_8_value ( ) const
inline

Get value stored in NdbRecAttr object.

Returns
Uint8 value.

Definition at line 373 of file NdbRecAttr.hpp.

Uint8 NdbRecAttr::u_char_value ( ) const
inline

Get value stored in NdbRecAttr object.

Returns
Unsigned char value.

Definition at line 366 of file NdbRecAttr.hpp.

Uint32 NdbRecAttr::u_medium_value ( ) const

Get value stored in NdbRecAttr object.

Returns
Unsigned medium value.

Definition at line 232 of file NdbRecAttr.cpp.

Uint16 NdbRecAttr::u_short_value ( ) const
inline

Get value stored in NdbRecAttr object.

Returns
Unsigned short value.

Definition at line 359 of file NdbRecAttr.hpp.

Friends And Related Function Documentation

friend class Ndb
friend

Reciver(s)

Definition at line 82 of file NdbRecAttr.hpp.

friend class NdbOperation
friend

Sender(s)

Definition at line 77 of file NdbRecAttr.hpp.


The documentation for this class was generated from the following files: