tntdb::Value Class Reference

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

`#include <value.h>`

## Public Member Functions

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

## Detailed Description

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

## 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:

- tntdb/bits/value.h