cqosdb::MetaDB Class Reference

An implementation of DB iterfaces. More...

#include <MetaDB.hxx>

Inheritance diagram for cqosdb::MetaDB:

cqosdb::DB

List of all members.

Public Member Functions

 MetaDB ()
 ~MetaDB ()
bool connect ()
 Connect to a database server.
void disconnect ()
 Disconnect to a database server.
bool isClosed ()
 Test if connected to a database.
void setConnectionInfo (string info)
 Set up connection information, which typically includes database server name, port number, user authorization etc.
string getConnectionInfo ()
 Get the connection setup information.
string getConnectionInfoFromDefaultPerfDMFConfig ()
 Get connection information (including user name, password, etc.
string getConnectionInfoFromPerfDMFConfig (string configFileName)
 Get connection information (including user name, password, etc.
int bindParameters (int param, int argument)
 Pass an integer parameter to SQL command text.
int bindParameters (int param, long argument)
 Pass a long parameter to SQL command text.
int bindParameters (int param, double argument)
 Pass a double parameter to SQL command text.
int bindParameters (int param, string argument)
 Pass a string parameter to SQL command text.
void bindCommand ()
 Bind parameters to SQL command text, the function is usually called immediately before executing a SQL command.
void resetQuery ()
 Reset query statement.
int executeQuery_bindParam (string &commd, Outcome *res)
 Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text.
int executeQuery (string &commd, Outcome *res)
 Submits a command to the server and waits for the result, without passing parameters separately.
int executeInsert (string &commd)
 Submits a 'insert' command to the server.
void storeParameter (int trialID, string interEvt, Parameter &aParam)
 Store a DefaultyProperty into database.
void storeParameterSet (int trialID, string interEvt, ParameterSet &aParamSet)
 Store a PropertySet into database.
int getMatchingTrialsBetween (ParameterSet &lower, ParameterSet &upper, Outcome *trialIDs)
 Retrieve trials from database.
int getMatchingTrials (ParameterSet &lower, vector< double > epsilons, Outcome *trialIDs)
 Retrieve trials from database.
void getParameter (int trialID, string interEvt, Parameter *aParam)
 Retrieve DefaultProperty value from database.
void getParameterSet (int trialID, string interEvt, ParameterSet *aParamSet)
 Retrieve PropertySet values from database.

Public Attributes

PGconn * conn
 connection to the server in PostgreSQL

Private Attributes

int connected
 flag that shows if connected to a database server
const char * conninfo
 connection information
int paramCount
 count of parameters in a SQL string text
const char * paramValues [MAXPARAMCOUNT]
 array of parameters in a SQL string text, which will be used in executeQuery_bindParam().
map< int, string > stringarg
 a map of parameter index to parameter name.


Detailed Description

An implementation of DB iterfaces.

Please refer to DB.hxx for details of each function


Constructor & Destructor Documentation

cqosdb::MetaDB::MetaDB (  ) 

cqosdb::MetaDB::~MetaDB (  ) 


Member Function Documentation

bool cqosdb::MetaDB::connect (  )  [virtual]

Connect to a database server.

Implements cqosdb::DB.

void cqosdb::MetaDB::disconnect (  )  [virtual]

Disconnect to a database server.

Implements cqosdb::DB.

bool cqosdb::MetaDB::isClosed (  )  [virtual]

Test if connected to a database.

Implements cqosdb::DB.

void cqosdb::MetaDB::setConnectionInfo ( string  info  )  [virtual]

Set up connection information, which typically includes database server name, port number, user authorization etc.

Implements cqosdb::DB.

string cqosdb::MetaDB::getConnectionInfo (  )  [virtual]

Get the connection setup information.

Implements cqosdb::DB.

string cqosdb::MetaDB::getConnectionInfoFromDefaultPerfDMFConfig (  ) 

Get connection information (including user name, password, etc.

) from default PerfDMF configuration file located at ~/.ParaProf/perfdmf.cfg

string cqosdb::MetaDB::getConnectionInfoFromPerfDMFConfig ( string  configFileName  ) 

Get connection information (including user name, password, etc.

) from user input 'configFileName'. Note the file path is absolute.

int cqosdb::MetaDB::bindParameters ( int  param,
int  argument 
) [virtual]

Pass an integer parameter to SQL command text.

Parameters:
param Index of parameter
argument Value of the parameter

Implements cqosdb::DB.

int cqosdb::MetaDB::bindParameters ( int  param,
long  argument 
) [virtual]

Pass a long parameter to SQL command text.

Parameters:
param Index of parameter
argument Value of the parameter

Implements cqosdb::DB.

int cqosdb::MetaDB::bindParameters ( int  param,
double  argument 
) [virtual]

Pass a double parameter to SQL command text.

Parameters:
param Index of parameter
argument Value of the parameter

Implements cqosdb::DB.

int cqosdb::MetaDB::bindParameters ( int  param,
string  argument 
) [virtual]

Pass a string parameter to SQL command text.

Parameters:
param Index of parameter
argument Value of the parameter

Implements cqosdb::DB.

void cqosdb::MetaDB::bindCommand (  )  [virtual]

Bind parameters to SQL command text, the function is usually called immediately before executing a SQL command.

Implements cqosdb::DB.

void cqosdb::MetaDB::resetQuery (  )  [virtual]

Reset query statement.

Usually called after executing a SQL command

Implements cqosdb::DB.

int cqosdb::MetaDB::executeQuery_bindParam ( string &  commd,
Outcome res 
) [virtual]

Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text.

Parameters:
commd The SQL command string to be executed. If parameters are used, they are referred to in the command string as $1, $2, etc.
res Returned query result set

Implements cqosdb::DB.

int cqosdb::MetaDB::executeQuery ( string &  commd,
Outcome res 
) [virtual]

Submits a command to the server and waits for the result, without passing parameters separately.

Parameters:
commd The SQL command string to be executed.
res Returned query result set

Implements cqosdb::DB.

int cqosdb::MetaDB::executeInsert ( string &  commd  )  [virtual]

Submits a 'insert' command to the server.

Parameters:
commd The insert SQL command string to be executed.

Implements cqosdb::DB.

void cqosdb::MetaDB::storeParameter ( int  trialID,
string  interEvt,
Parameter aParam 
) [virtual]

Store a DefaultyProperty into database.

This function assumes that default database schema (meta_dbschema.sql) is used.

Parameters:
trialID The trial associated with the parameter
interEvt The interval_event associated with the parameter
aParam The DefaultProperty object to be stored

Implements cqosdb::DB.

void cqosdb::MetaDB::storeParameterSet ( int  trialID,
string  interEvt,
ParameterSet aParamSet 
) [virtual]

Store a PropertySet into database.

This function assumes that default database schema (meta_dbschema.sql) is used.

Parameters:
trialID The trial associated with the parameter set
interEvt The interval_event associated with the parameter set
aParamSet The PropertySet to be stored

Implements cqosdb::DB.

int cqosdb::MetaDB::getMatchingTrialsBetween ( ParameterSet lower,
ParameterSet upper,
Outcome trialIDs 
) [virtual]

Retrieve trials from database.

The trial have parameters of the same name in 'lower' and 'upper', and the parameter values is within [lower, upper]. For example, lower=[('nsplit', 'double', 23.0), ('split', 'double', 2.0)], and upper=[('nsplit', 'double', 455.0), ('split', 'double', 677.0)] Then the function returns trials whose parameters 'nsplit' and 'split' satisfy: 23.0 <= nsplit <= 455.0 AND 2.0 <= split<= 677.0. This function assumes that default database schema (meta_dbschema.sql) is used.

Implements cqosdb::DB.

int cqosdb::MetaDB::getMatchingTrials ( ParameterSet lower,
vector< double >  epsilons,
Outcome trialIDs 
) [virtual]

Retrieve trials from database.

The trials have parameter of the same name in 'lower', and the parameter values is within [lower-epsilons, lower+epsilons]. For example, lower=[('nsplit', 'double', 23.0), ('split', 'double', 2.0)], and epsilons = [3.0, 56.0], Then the function returns trials whose parameters 'nsplit' and 'split' satisfy: abs(nsplit-23.0) <= 3.0 AND abs(split-2.0)<= 56.0. This function assumes that default database schema (meta_dbschema.sql) is used.

Implements cqosdb::DB.

void cqosdb::MetaDB::getParameter ( int  trialID,
string  interEvt,
Parameter aParam 
) [virtual]

Retrieve DefaultProperty value from database.

This function assumes that default database schema (meta_dbschema.sql) is used.

Parameters:
trialID The trial associated with the parameter
interEvt The interval_event associated with the parameter
aParam in - set parameter name and type; out - fill in value from database

Implements cqosdb::DB.

void cqosdb::MetaDB::getParameterSet ( int  trialID,
string  interEvt,
ParameterSet aParamSet 
) [virtual]

Retrieve PropertySet values from database.

This function assumes that default database schema (meta_dbschema.sql) is used.

Parameters:
trialID The trial associated with the parameter set
interEvt The interval_event associated with the parameter set
aParamSet in - set parameter set name and type; out - fill in values from database

Implements cqosdb::DB.


Member Data Documentation

connection to the server in PostgreSQL

flag that shows if connected to a database server

const char* cqosdb::MetaDB::conninfo [private]

connection information

count of parameters in a SQL string text

const char* cqosdb::MetaDB::paramValues[MAXPARAMCOUNT] [private]

array of parameters in a SQL string text, which will be used in executeQuery_bindParam().

map<int, string> cqosdb::MetaDB::stringarg [private]

a map of parameter index to parameter name.


The documentation for this class was generated from the following files:

Generated on Tue Sep 23 19:59:06 2008 for CQoS Database Library by  doxygen 1.5.5