QDb Class Reference

Inheritance diagram for QDb:

QApolloDbBase List of all members.

Detailed Description

base class for db interface


Public Types

typedef std::vector< QVdt > column
typedef std::map< std::string,
column > 
QDbTable

Public Member Functions

double DoQueryDouble (const std::string &Query)
 make query and expect a single double as output
int DoQueryInt (const std::string &Query)
 make query and expect a single int as output
bool DoQueryBool (const std::string &Query)
 make query and expect a single bool as output
std::string DoQueryString (const std::string &Query)
 make query and expect a single string as output
std::vector< double > & DoQueryVectorDouble (const std::string &Query)
 make query and expect a vector of double as output
const QDbTable DoQuery (const std::string &Query, int MaxLines=1000)
 make query and expect a table as output
bool DoSQLNoReturn (const std::string &query)
 make query and expect no output
int DoExec (const std::string &Query)
 Execute an INSERT, UPDATE, DELETE, FETCH, or MOVE statement.

Protected Member Functions

 QDb (const std::string &ip, const std::string &port, const std::string &usr, const std::string &pwd, const std::string &db)
 protected constructor called by child classes
bool Connect ()
 open connection to db
bool DisConnect ()
 close connection to db
bool isConnected () const
 check connection status
const QDbTable DoQuery (const std::string &Table, const std::string &Where, const std::string &Fields, const std::string &Order, int MaxLines)
 Perform a SELECT query with simplified syntax.
const char * DataBase () const

Private Member Functions

const char * Server () const
const char * Port () const
const char * User () const
const char * Passwd () const

Private Attributes

PGconn * fConnection
bool fConnected
std::string fServerIpAddress
std::string fServerIpPort
std::string fUserName
std::string fPasswd
std::string fDataBase


Constructor & Destructor Documentation

QDb::QDb ( const std::string &  ip,
const std::string &  port,
const std::string &  usr,
const std::string &  pwd,
const std::string &  db 
) [protected]

protected constructor called by child classes

Parameters:
ip network address or name of the db host
port port the db is listening to
usr username for db authentication
pwd password for db authentication
db db name


Member Function Documentation

const QDb::QDbTable QDb::DoQuery ( const std::string &  Query,
int  MaxLines = 1000 
)

make query and expect a table as output

Parameters:
MaxLines determine max number of lines to be returned by the query.
  • If Maxlines is zero all ntuples are returned.
  • If Maxlines is positive at most MaxLines are returned.
  • An exception is thrown if MaxLines is negative and the performed query returned more than (-MaxLines) ntuples.

int QDb::DoExec ( const std::string &  Query  ) 

Execute an INSERT, UPDATE, DELETE, FETCH, or MOVE statement.

Returns:
Number of rows affected

bool QDb::isConnected (  )  const [inline, protected]

check connection status

Returns:
true if connected, false otherwise


The documentation for this class was generated from the following files:
Generated on Fri Mar 6 13:40:42 2009 for CUORE Software by  doxygen 1.5.1