tntdb::Value Class Reference

The class Value represents a value, which is fetched from the database. More...

#include <tntdb/bits/value.h>

Public Member Functions

 Value (IValue *value=0)
template<typename T >
bool getValue (T &ret) const
 Explicit data-access.
template<typename T >
bool get (T &ret) const
 Shorter name for getValue.
bool operator! () const
 Returns true, if this class is not connected to a actual statement.
const IValuegetImpl () const
 Returns the actual implementation-class.
bool isNull () const
 Explicit data-access.
bool getBool () const
 return true, when value represents boolean true.
short getShort () const
 tries to convert value into an short.
int getInt () const
 tries to convert value into an int.
long getLong () const
 tries to convert value into an long.
unsigned short getUnsignedShort () const
 tries to convert value into an unsigned short.
unsigned getUnsigned () const
 tries to convert value into an unsigned.
unsigned long getUnsignedLong () const
 tries to convert value into an unsigned long.
int32_t getInt32 () const
 tries to convert value into an int32_t.
uint32_t getUnsigned32 () const
 tries to convert value into an uint32_t.
int64_t getInt64 () const
 tries to convert value into an int64_t.
uint64_t getUnsigned64 () const
 tries to convert value into an uint64_t.
Decimal getDecimal () const
 tries to convert value into a Decimal.
float getFloat () const
 tries to convert value into an float.
double getDouble () const
 tries to convert value into an double.
char getChar () const
 returns the first character of the text-representation.
std::string getString () const
 returns the value as a string.
void getString (std::string &ret) const
 fills the passed string with the value.
cxxtools::String getUString () const
 returns the value as a unicode string.
void getUString (cxxtools::String &ret) const
 Explicit data-access.
Blob getBlob () const
 Returns the value as a blob.
void getBlob (Blob &blob) const
 Returns the value as a blob.
Date getDate () const
 returns the value as a Date.
Time getTime () const
 returns the value as a Time.
Datetime getDatetime () const
 returns the value as a Datetime.

Detailed Description

The class Value represents a value, which is fetched from the database.

Constructor & Destructor Documentation

tntdb::Value::Value ( IValue value = 0)
inlineexplicit

Member Function Documentation

template<typename T >
bool tntdb::Value::get ( T &  ret) const
inline

Shorter name for getValue.

Blob tntdb::Value::getBlob ( ) const
inline

Returns the value as a blob.

This is more or less an alias to getString just to stress, that the data is truly binary and not some text value.

void tntdb::Value::getBlob ( Blob blob) const
inline

Returns the value as a blob.

bool tntdb::Value::getBool ( ) const
inline

return true, when value represents boolean true.

char tntdb::Value::getChar ( ) const
inline

returns the first character of the text-representation.

Date tntdb::Value::getDate ( ) const
inline

returns the value as a Date.

Datetime tntdb::Value::getDatetime ( ) const
inline

returns the value as a Datetime.

Decimal tntdb::Value::getDecimal ( ) const
inline

tries to convert value into a Decimal.

double tntdb::Value::getDouble ( ) const
inline

tries to convert value into an double.

float tntdb::Value::getFloat ( ) const
inline

tries to convert value into an float.

const IValue* tntdb::Value::getImpl ( ) const
inline

Returns the actual implementation-class.

int tntdb::Value::getInt ( ) const
inline

tries to convert value into an int.

int32_t tntdb::Value::getInt32 ( ) const
inline

tries to convert value into an int32_t.

int64_t tntdb::Value::getInt64 ( ) const
inline

tries to convert value into an int64_t.

long tntdb::Value::getLong ( ) const
inline

tries to convert value into an long.

short tntdb::Value::getShort ( ) const
inline

tries to convert value into an short.

std::string tntdb::Value::getString ( ) const
inline

returns the value as a string.

void tntdb::Value::getString ( std::string &  ret) const
inline

fills the passed string with the value.

this might be slightly more efficient than just returning a new string since one copy is saved.

Time tntdb::Value::getTime ( ) const
inline

returns the value as a Time.

unsigned tntdb::Value::getUnsigned ( ) const
inline

tries to convert value into an unsigned.

uint32_t tntdb::Value::getUnsigned32 ( ) const
inline

tries to convert value into an uint32_t.

uint64_t tntdb::Value::getUnsigned64 ( ) const
inline

tries to convert value into an uint64_t.

unsigned long tntdb::Value::getUnsignedLong ( ) const
inline

tries to convert value into an unsigned long.

unsigned short tntdb::Value::getUnsignedShort ( ) const
inline

tries to convert value into an unsigned short.

cxxtools::String tntdb::Value::getUString ( ) const
inline

returns the value as a unicode string.

void tntdb::Value::getUString ( cxxtools::String ret) const
inline

Explicit data-access.

The getXXX-methods return the value in the requested type. If the value can't be converted to the requested type, a exception of type tntdb::TypeError is thrown.return true, when value is null

template<typename T >
bool tntdb::Value::getValue ( T &  ret) const
inline

Explicit data-access.

The get-template return false if the value is null. Otherwise the passed reference is filled with the value. If the value can't be converted to the requested type, a exception of type tntdb::TypeError is thrown.

In contrast to the getXXX-methods the type is not specified explictely but determined by the passed reference.

The extraction is actually done using the operator>> with a l-value of const Value& and a r-value of a reference to the actual type. This operator is defined for standard types and may be defined for user defined types.

bool tntdb::Value::isNull ( ) const
inline

Explicit data-access.

The getXXX-methods return the value in the requested type. If the value can't be converted to the requested type, a exception of type tntdb::TypeError is thrown.return true, when value is null

bool tntdb::Value::operator! ( ) const
inline

Returns true, if this class is not connected to a actual statement.


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