Main Page | Namespace List | Alphabetical List | Class List | Directories | File List | Class Members | File Members

DBInterface Class Reference

#include <DBInterface.h>

List of all members.

Public Member Functions

 DBInterface ()
 DBInterface (const char *, const char *, const char *, const char *)
 ~DBInterface ()
void checkDatabaseConnection (mysqlpp::Connection *&conn)
bool connectToDatabase (bool useEx)
const DBParameters getDBParameters ()
mysqlpp::Connection * getNewConnection ()
mysqlpp::Query getQuery ()

Private Member Functions

 DBInterface (const DBInterface &)
DBInterface operator= (const DBInterface &)
bool connectToDatabase (mysqlpp::Connection *&conn)

Private Attributes

mysqlpp::Connection * connection
vector< mysqlpp::Connection * > connectionVector
DBParameters dbParam
bool useExceptions


Detailed Description

Interfaces with the data base, creating query objects for use by other classes.

Definition at line 47 of file DBInterface.h.


Constructor & Destructor Documentation

DBInterface::DBInterface  ) 
 

Empty default constructor - not used.

Definition at line 36 of file DBInterface.cpp.

DBInterface::DBInterface const char *  host,
const char *  user,
const char *  password,
const char *  database
 

Main constructor.

Definition at line 41 of file DBInterface.cpp.

References DBParameters::database, dbParam, DBParameters::host, DBParameters::maxParamLength, DBParameters::password, Utilities::safeCStringCopy(), and DBParameters::user.

DBInterface::~DBInterface  ) 
 

Destructor.

Definition at line 50 of file DBInterface.cpp.

References connection, and connectionVector.

DBInterface::DBInterface const DBInterface  )  [private]
 

Declare copy constructor private so it cannot be used inadvertently.


Member Function Documentation

void DBInterface::checkDatabaseConnection mysqlpp::Connection *&  conn  ) 
 

Referenced by getQuery().

bool DBInterface::connectToDatabase mysqlpp::Connection *&  conn  )  [private]
 

bool DBInterface::connectToDatabase bool  useEx  ) 
 

Connects to the database using the parameters stored in the constructor.

Definition at line 112 of file DBInterface.cpp.

References connection, and useExceptions.

Referenced by getNewConnection().

const DBParameters DBInterface::getDBParameters  ) 
 

Returns the database parameters. Mainly used for passing dbparameters to spawned processes.

Definition at line 124 of file DBInterface.cpp.

References dbParam.

Connection * DBInterface::getNewConnection  ) 
 

Creates a new connection and returns it. This is generally used for large queries, which need to use ResUse instead of Result. NOTE: Exception handling should be done by the calling class.

Definition at line 132 of file DBInterface.cpp.

References connectionVector, connectToDatabase(), and useExceptions.

Query DBInterface::getQuery  ) 
 

Returns the query from the main connection. Throws an exception if the database connection has failed and cannot be restored.

Definition at line 150 of file DBInterface.cpp.

References checkDatabaseConnection(), and connection.

DBInterface DBInterface::operator= const DBInterface  )  [private]
 

Declare assignment private so it cannot be used.


Member Data Documentation

mysqlpp::Connection* DBInterface::connection [private]
 

Main connection to database. Used most of the time by other classes.

Definition at line 63 of file DBInterface.h.

Referenced by connectToDatabase(), getQuery(), and ~DBInterface().

vector<mysqlpp::Connection*> DBInterface::connectionVector [private]
 

Vector containing other connections to database that have been created These are generally created for large fast queries using ResUse.

Definition at line 67 of file DBInterface.h.

Referenced by getNewConnection(), and ~DBInterface().

DBParameters DBInterface::dbParam [private]
 

Parameters for database connection Stored to prevent them from disappearing and to pass them on elsewhere when required.

Definition at line 72 of file DBInterface.h.

Referenced by DBInterface(), and getDBParameters().

bool DBInterface::useExceptions [private]
 

Records whether we are using exceptions or not.

Definition at line 75 of file DBInterface.h.

Referenced by connectToDatabase(), and getNewConnection().


The documentation for this class was generated from the following files:
Generated on Mon Sep 3 22:18:50 2007 for SpikeStream Library by  doxygen 1.4.4