NdbRecAttr Class Reference

Contains value of an attribute. More...

#include <NdbRecAttr.hpp>

List of all members.

Public Member Functions

NdbRecAttrclone () const
 ~NdbRecAttr ()
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

Private Member Functions

Uint32 attrId () const
bool setNULL ()
void setUNDEFINED ()
bool receive_data (const Uint32 *, Uint32)
void release ()
void init ()
 NdbRecAttr (Ndb *)
void next (NdbRecAttr *aRecAttr)
NdbRecAttrnext ()
int setup (const class NdbDictionary::Column *col, char *aValue)
int setup (const class NdbColumnImpl *anAttrInfo, char *aValue)
int setup (Uint32 byteSize, char *aValue)
bool copyoutRequired () const
void copyout ()
 NdbRecAttr (const NdbRecAttr &)
NdbRecAttroperator= (const NdbRecAttr &)

Private Attributes

Uint64 theStorage [4]
Uint64 * theStorageX
char * theValue
void * theRef
NdbRecAttrtheNext
Uint32 theAttrId
Int32 m_size_in_bytes
const NdbDictionary::Columnm_column
Uint16 * m_getVarValue

Friends

struct Ndb_free_list_t< NdbRecAttr >


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.

Constructor & Destructor Documentation

NdbRecAttr::~NdbRecAttr (  ) 

Destructor

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

NdbRecAttr::NdbRecAttr ( Ndb  )  [private]

NdbRecAttr::NdbRecAttr ( const NdbRecAttr  )  [private]


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::attrId (  )  const [private]

char NdbRecAttr::char_value (  )  const

Get value stored in NdbRecAttr object.

Returns:
Char value.

NdbRecAttr* NdbRecAttr::clone (  )  const

Make a copy of RecAttr object including all data.

Note:
Copy needs to be deleted by application program.

void NdbRecAttr::copyout (  )  [private]

bool NdbRecAttr::copyoutRequired (  )  const [private]

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.

Uint32 NdbRecAttr::get_size_in_bytes (  )  const [inline]

Get attribute (element) size in bytes.

const NdbDictionary::Column* NdbRecAttr::getColumn (  )  const

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

Get type of column

Returns:
Data type of the column

void NdbRecAttr::init (  )  [private]

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.

Int8 NdbRecAttr::int8_value (  )  const

Get value stored in NdbRecAttr object.

Returns:
Int8 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.

Int32 NdbRecAttr::medium_value (  )  const

Get value stored in NdbRecAttr object.

Returns:
Medium value.

NdbRecAttr* NdbRecAttr::next (  )  [private]

void NdbRecAttr::next ( NdbRecAttr aRecAttr  )  [private]

NdbRecAttr& NdbRecAttr::operator= ( const NdbRecAttr  )  [private]

bool NdbRecAttr::receive_data ( const Uint32 *  ,
Uint32   
) [private]

void NdbRecAttr::release (  )  [private]

bool NdbRecAttr::setNULL (  )  [private]

void NdbRecAttr::setUNDEFINED (  )  [private]

int NdbRecAttr::setup ( Uint32  byteSize,
char *  aValue 
) [private]

int NdbRecAttr::setup ( const class NdbColumnImpl *  anAttrInfo,
char *  aValue 
) [private]

int NdbRecAttr::setup ( const class NdbDictionary::Column col,
char *  aValue 
) [private]

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_8_value (  )  const

Get value stored in NdbRecAttr object.

Returns:
Uint8 value.

Uint8 NdbRecAttr::u_char_value (  )  const

Get value stored in NdbRecAttr object.

Returns:
Unsigned char value.

Uint32 NdbRecAttr::u_medium_value (  )  const

Get value stored in NdbRecAttr object.

Returns:
Unsigned medium value.

Uint16 NdbRecAttr::u_short_value (  )  const

Get value stored in NdbRecAttr object.

Returns:
Unsigned short value.


Friends And Related Function Documentation

friend struct Ndb_free_list_t< NdbRecAttr > [friend]


Member Data Documentation

Uint16* NdbRecAttr::m_getVarValue [private]

Int32 NdbRecAttr::m_size_in_bytes [private]

Uint32 NdbRecAttr::theAttrId [private]

void* NdbRecAttr::theRef [private]

Uint64 NdbRecAttr::theStorage[4] [private]

Uint64* NdbRecAttr::theStorageX [private]

char* NdbRecAttr::theValue [private]


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

MySQL Cluster Database Blog

Based on MySQL Cluster 7.0.10.

This page is for information only and is not maintained by MySQL or Sun Microsystems - use at your own risk. For an upto date view of the API refer to the header files included with your MySQL Cluster distribution or check the MySQL Cluster API Developer Guide.