tntdb Namespace Reference

Main namespace for tntdb. More...

## Classes

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 | 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 | TypeError
| Exception to indicate, that a value couldn't be converted to a requested type. More...
class | SqlError
| Exception, which is a direct result of a sql-statement. More...
class | FieldNotFound
class | LibraryManager
class | SqlBuilder
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 | Blob
| Binary large objects. More...
class | BlobStreamBuf
| streambuf for reading from a tntdb::Blob More...
class | BlobIStream
| istream for reading from a tntdb::Blob More...
class | Connection
| This class holds a connection to a database. 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 | Statement
| This class represents a sql-statement. More...
class | Hostvar
| Helper class to hold a tntdb::Statement and a column name. 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

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");

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.

void tntdb::dropCached | ( | unsigned | keep = `0`) |  |

Releases unused connections.

Keeps the given number of connections.

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

Releases unused connections, which match the given url.

Keeps the given number of connections.

unsigned tntdb::getMaxPoolSize | ( | ) |  |

Returns the current setting for maximum pools size.

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

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

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

inline

Set operators for host variables.

template<typename T >

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

Set operators for host variables.

template<typename T >

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

Set operators for host variables.

template<typename T >

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

Set operators for host variables.

template<typename T >

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

Set operators for host variables.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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

inline

Extraction operators for standard types.

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.