Value Class Reference

#include <Pt/Db/Value.h>

One column value of a query result. More...

Public Member Functions

 Value (IValue *value=0)
 Takes ownership of the backend value.
bool isNull () const
 Returns true if the value is unbound or SQL NULL.
bool getBool () const
 Returns the value as bool.
int getInt () const
 Returns the value as int.
unsigned getUnsigned () const
 Returns the value as unsigned.
float getFloat () const
 Returns the value as float.
double getDouble () const
 Returns the value as double.
char getChar () const
 Returns the value as char.
std::string getString () const
 Returns the value as string.
Date getDate () const
 Returns the value as date.
Time getTime () const
 Returns the value as time.
DateTime getDateTime () const
 Returns the value as date-time.
bool operator! () const
 Returns true if this object is not bound to a value.
const IValuegetImpl () const
 Returns the backend implementation.
void getBlob (Blob &blobdata) const
 Writes the value as binary data into blobdata.

Detailed Description

Value is one column of a Row. It is a shared value. An unbound value and SQL NULL both make isNull() true. operator!() is true when the object is not bound.

Typed getters convert the stored value. A null or a conversion that cannot be performed throws TypeMismatch. getChar() on a string returns the first character. getBlob() writes binary data into a Blob.

Member Function Documentation

◆ getBool()

bool getBool ( ) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getInt()

int getInt ( ) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getUnsigned()

unsigned getUnsigned ( ) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getFloat()

float getFloat ( ) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getDouble()

double getDouble ( ) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getChar()

char getChar ( ) const

If the value is a string, the first character is returned.

Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getString()

std::string getString ( ) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getDate()

Date getDate ( ) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getTime()

Time getTime ( ) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getDateTime()

DateTime getDateTime ( ) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.

◆ getBlob()

void getBlob ( Blob & blobdata) const
Exceptions
%TypeMismatchif the value is null or cannot be converted.