Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

tntdb Namespace Reference


Classes

class  Blob
 Binary large objects. More...
class  Connection
class  Result
class  Row
class  Statement
class  Value
class  ConnectionPool
class  ConnectionPools
class  Date
class  Datetime
class  Decimal
class  Error
class  NotFound
class  NullValue
class  TypeError
class  SqlError
class  FieldNotFound
class  IBlob
 Implementation base of Blob values. More...
class  IConnection
class  IStmtCacheConnection
class  IConnectionManager
class  ICursor
class  IResult
 common inteface for resultset More...
class  IRow
 common interface for row-types More...
class  IStatement
class  IValue
 common inteface for resultvalues More...
class  BlobImpl
 Default Blob value implementation. More...
struct  BlobDataInitializer
class  PoolConnection
class  ResultImpl
class  RowImpl
class  ValueImpl
class  LibraryManager
class  StmtEvent
class  StmtParser
class  Time
class  Transaction

Functions

Connection connect (const std::string &url)
Connection connectCached (const std::string &url)
void dropCached (unsigned keep=0)
void dropCached (const std::string &url, unsigned keep=0)
void setMaxPoolSize (unsigned max)
unsigned getMaxPoolSize ()
std::ostream & operator<< (std::ostream &out, const Decimal &decimal)
std::istream & operator>> (std::istream &in, Decimal &decimal)
 Read a Decimal number.


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 ( const std::string &  url,
unsigned  keep = 0 
)

Releases unused connections, which match the given url. Keeps the given number of connections.

void tntdb::dropCached ( unsigned  keep = 0  ) 

Releases unused connections. 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

std::ostream& tntdb::operator<< ( std::ostream &  out,
const Decimal &  decimal 
)

Print this Decimal number. If out.precision() != 0, then this decimal number is printed with out.precision() significant digits.

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.

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6