tntdb  1.3
tntdb Namespace Reference

Main namespace for tntdb. More...

Classes

class  Blob
 Binary large objects. More...
 
class  BlobIStream
 istream for reading from a tntdb::Blob More...
 
class  BlobStreamBuf
 streambuf for reading from a tntdb::Blob More...
 
class  Connection
 This class holds a connection to a database. More...
 
class  ConnectionPool
 
class  ConnectionPools
 
class  Date
 This class holds a date. More...
 
class  Datetime
 This class holds a date and a time. More...
 
class  Decimal
 
class  Error
 Baseclass for database-errors. More...
 
class  FieldNotFound
 
class  Hostvar
 Helper class to hold a tntdb::Statement and a column name. More...
 
class  LibraryManager
 
class  NotFound
 Thrown, if selectRow or selectValue does not fetch any data. More...
 
class  NullValue
 This exception is thrown, when a value is extracted with Value::get...(), but the value is null. More...
 
class  Result
 The class holds a resultset of a query. More...
 
class  Row
 Row represents a row, which is fetched from the database. More...
 
class  RowReader
 A RowReader is a class which helps reading multiple columns from a row. More...
 
class  SqlBuilder
 
class  SqlError
 Exception, which is a direct result of a sql-statement. More...
 
class  Statement
 This class represents a sql-statement. More...
 
class  StmtEvent
 
class  StmtParser
 
class  Time
 This class holds a time. More...
 
class  Transaction
 The class Transaction monitors the state of a transaction on a database-conection. More...
 
class  TypeError
 Exception to indicate, that a value couldn't be converted to a requested type. More...
 
class  Value
 The class Value represents a value, which is fetched from the database. More...
 

Functions

Connection connect (const std::string &url)
 Establish a connection to a database. More...
 
Connection connectCached (const std::string &url)
 Fetch a connection from a pool or create a new one. More...
 
void dropCached (unsigned keep=0)
 Releases unused connections. More...
 
void dropCached (const std::string &url, unsigned keep=0)
 Releases unused connections, which match the given url. More...
 
void setMaxPoolSize (unsigned max)
 Sets the maximum pool-size of new connectionpools. More...
 
unsigned getMaxPoolSize ()
 Returns the current setting for maximum pools size. More...
 
std::istream & operator>> (std::istream &in, Decimal &dec)
 
std::ostream & operator<< (std::ostream &out, const Decimal &dec)
 
void operator<< (Hostvar &hostvar, bool data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, int data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, long data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, unsigned data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, unsigned long data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, int32_t data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, uint32_t data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, int64_t data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, uint64_t data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, const Decimal &data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, float data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, double data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, char data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, const std::string &data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, const char *data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, const cxxtools::String &data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, const Blob &data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, const Date &data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, const Time &data)
 Set operators for host variables. More...
 
void operator<< (Hostvar &hostvar, const Datetime &data)
 Set operators for host variables. More...
 
template<typename T >
void operator<< (Hostvar &hostvar, const std::vector< T > &data)
 Set operators for host variables. More...
 
template<typename T >
void operator<< (Hostvar &hostvar, const std::list< T > &data)
 Set operators for host variables. More...
 
template<typename T >
void operator<< (Hostvar &hostvar, const std::deque< T > &data)
 Set operators for host variables. More...
 
template<typename T >
void operator<< (Hostvar &hostvar, const std::set< T > &data)
 Set operators for host variables. More...
 
bool operator>> (const Value &value, bool &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, short &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, int &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, long &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, unsigned short &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, unsigned &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, unsigned long &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, int32_t &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, uint32_t &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, int64_t &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, uint64_t &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, Decimal &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, float &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, double &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, char &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, std::string &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, cxxtools::String &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, Blob &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, Date &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, Time &out)
 Extraction operators for standard types. More...
 
bool operator>> (const Value &value, Datetime &out)
 Extraction operators for standard types. More...
 

Detailed Description

Main namespace for tntdb.

All code is in this namespace.

Function Documentation

◆ connect()

Connection tntdb::connect ( const std::string &  url)

Establish a connection to a database.

The url is prefixed with a drivername followed by a colon and a driver- specific part. If the connection can't be established, a exception of type tntdb::Error or derived is thrown.

Examples:

tntdb::Connection sqConn = tntdb::connect("sqlite:mydatabase.db");
tntdb::Connection pgConn = tntdb::connect("postgresql:dbname=DS2 user=web passwd=web");
tntdb::Connection myConn = tntdb::connect("mysql:db=DS2;user=web;passwd=web");
tntdb::Connection orConn = tntdb::connect("oracle:XE;user=hr;passwd=hr");

◆ connectCached()

Connection tntdb::connectCached ( const std::string &  url)

Fetch a connection from a pool or create a new one.

A static pool of connections is kept in memory. The function looks in this pool, if there is a connection, which matches the url. If found the connection is removed from the pool and returned. When the returned connection-object is destroyed (and all copies of it), the actual connection is put back into the pool.

When there is no connections in the pool, which match the url, a new connection is established.

◆ dropCached() [1/2]

void tntdb::dropCached ( unsigned  keep = 0)

Releases unused connections.

Keeps the given number of connections.

◆ dropCached() [2/2]

void tntdb::dropCached ( const std::string &  url,
unsigned  keep = 0 
)

Releases unused connections, which match the given url.

Keeps the given number of connections.

◆ getMaxPoolSize()

unsigned tntdb::getMaxPoolSize ( )

Returns the current setting for maximum pools size.

The maximum pools size is used, when a new pool is created

◆ operator<<() [1/24]

void tntdb::operator<< ( Hostvar hostvar,
bool  data 
)
inline

Set operators for host variables.

◆ operator<<() [2/24]

void tntdb::operator<< ( Hostvar hostvar,
int  data 
)
inline

Set operators for host variables.

◆ operator<<() [3/24]

void tntdb::operator<< ( Hostvar hostvar,
long  data 
)
inline

Set operators for host variables.

◆ operator<<() [4/24]

void tntdb::operator<< ( Hostvar hostvar,
unsigned  data 
)
inline

Set operators for host variables.

◆ operator<<() [5/24]

void tntdb::operator<< ( Hostvar hostvar,
unsigned long  data 
)
inline

Set operators for host variables.

◆ operator<<() [6/24]

void tntdb::operator<< ( Hostvar hostvar,
int32_t  data 
)
inline

Set operators for host variables.

◆ operator<<() [7/24]

void tntdb::operator<< ( Hostvar hostvar,
uint32_t  data 
)
inline

Set operators for host variables.

◆ operator<<() [8/24]

void tntdb::operator<< ( Hostvar hostvar,
int64_t  data 
)
inline

Set operators for host variables.

◆ operator<<() [9/24]

void tntdb::operator<< ( Hostvar hostvar,
uint64_t  data 
)
inline

Set operators for host variables.

◆ operator<<() [10/24]

void tntdb::operator<< ( Hostvar hostvar,
const Decimal data 
)
inline

Set operators for host variables.

◆ operator<<() [11/24]

void tntdb::operator<< ( Hostvar hostvar,
float  data 
)
inline

Set operators for host variables.

◆ operator<<() [12/24]

void tntdb::operator<< ( Hostvar hostvar,
double  data 
)
inline

Set operators for host variables.

◆ operator<<() [13/24]

void tntdb::operator<< ( Hostvar hostvar,
char  data 
)
inline

Set operators for host variables.

◆ operator<<() [14/24]

void tntdb::operator<< ( Hostvar hostvar,
const std::string &  data 
)
inline

Set operators for host variables.

◆ operator<<() [15/24]

void tntdb::operator<< ( Hostvar hostvar,
const char *  data 
)
inline

Set operators for host variables.

◆ operator<<() [16/24]

void tntdb::operator<< ( Hostvar hostvar,
const cxxtools::String &  data 
)
inline

Set operators for host variables.

◆ operator<<() [17/24]

void tntdb::operator<< ( Hostvar hostvar,
const Blob data 
)
inline

Set operators for host variables.

◆ operator<<() [18/24]

void tntdb::operator<< ( Hostvar hostvar,
const Date data 
)
inline

Set operators for host variables.

◆ operator<<() [19/24]

void tntdb::operator<< ( Hostvar hostvar,
const Time data 
)
inline

Set operators for host variables.

◆ operator<<() [20/24]

void tntdb::operator<< ( Hostvar hostvar,
const Datetime data 
)
inline

Set operators for host variables.

◆ operator<<() [21/24]

template<typename T >
void tntdb::operator<< ( Hostvar hostvar,
const std::vector< T > &  data 
)

Set operators for host variables.

◆ operator<<() [22/24]

template<typename T >
void tntdb::operator<< ( Hostvar hostvar,
const std::list< T > &  data 
)

Set operators for host variables.

◆ operator<<() [23/24]

template<typename T >
void tntdb::operator<< ( Hostvar hostvar,
const std::deque< T > &  data 
)

Set operators for host variables.

◆ operator<<() [24/24]

template<typename T >
void tntdb::operator<< ( Hostvar hostvar,
const std::set< T > &  data 
)

Set operators for host variables.

◆ operator>>() [1/21]

bool tntdb::operator>> ( const Value value,
bool &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [2/21]

bool tntdb::operator>> ( const Value value,
short &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [3/21]

bool tntdb::operator>> ( const Value value,
int &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [4/21]

bool tntdb::operator>> ( const Value value,
long &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [5/21]

bool tntdb::operator>> ( const Value value,
unsigned short &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [6/21]

bool tntdb::operator>> ( const Value value,
unsigned &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [7/21]

bool tntdb::operator>> ( const Value value,
unsigned long &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [8/21]

bool tntdb::operator>> ( const Value value,
int32_t &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [9/21]

bool tntdb::operator>> ( const Value value,
uint32_t &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [10/21]

bool tntdb::operator>> ( const Value value,
int64_t &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [11/21]

bool tntdb::operator>> ( const Value value,
uint64_t &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [12/21]

bool tntdb::operator>> ( const Value value,
Decimal out 
)
inline

Extraction operators for standard types.

◆ operator>>() [13/21]

bool tntdb::operator>> ( const Value value,
float &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [14/21]

bool tntdb::operator>> ( const Value value,
double &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [15/21]

bool tntdb::operator>> ( const Value value,
char &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [16/21]

bool tntdb::operator>> ( const Value value,
std::string &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [17/21]

bool tntdb::operator>> ( const Value value,
cxxtools::String &  out 
)
inline

Extraction operators for standard types.

◆ operator>>() [18/21]

bool tntdb::operator>> ( const Value value,
Blob out 
)
inline

Extraction operators for standard types.

◆ operator>>() [19/21]

bool tntdb::operator>> ( const Value value,
Date out 
)
inline

Extraction operators for standard types.

◆ operator>>() [20/21]

bool tntdb::operator>> ( const Value value,
Time out 
)
inline

Extraction operators for standard types.

◆ operator>>() [21/21]

bool tntdb::operator>> ( const Value value,
Datetime out 
)
inline

Extraction operators for standard types.

◆ setMaxPoolSize()

void tntdb::setMaxPoolSize ( unsigned  max)

Sets the maximum pool-size of new connectionpools.

When the maximum number of connections to a specific url is reached, connectCached blocks until a connection is available. The setting do not affect pools with active connections. You should release all connections and drop clear the pool to your url with dropCached(url), which recreates the pool.