Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DbSvc Class Reference

#include </dev/shm/kenichi/update-github-e1039-doc/e1039-core/packages/db_svc/DbSvc.h>

Classes

class  VarList
 

Public Types

enum  SvrId_t {
  DB1, DB2, DB3, DB01,
  UIUC, LITE, LOCAL
}
 
enum  UsrId_t { Guest, Prod }
 

Public Member Functions

 DbSvc (const SvrId_t svr_id=DB1, const UsrId_t usr_id=Guest, const std::string my_cnf="")
 
 DbSvc (const SvrId_t svr_id, std::string dbfile)
 
 ~DbSvc ()
 
void UseSchema (const char *name, const bool do_create=false, const bool do_drop=false)
 
void UseSchema (const std::string name, const bool do_create=false, const bool do_drop=false)
 
void DropTable (const char *name)
 
void DropTable (const std::string name)
 
bool HasTable (const char *name, const bool exit_on_false=false)
 
bool HasTable (const std::string name, const bool exit_on_false=false)
 
void CreateTable (const std::string name, const std::vector< std::string > list_var, const std::vector< std::string > list_type, const std::vector< std::string > list_key)
 
void CreateTable (const std::string name, const int n_var, const char **list_var, const char **list_type, const int n_key=0, const char **list_key=0)
 
void CreateTable (const std::string name, const VarList list)
 
TSQLServer * Con ()
 
TSQLStatement * Process (const char *query)
 
TSQLStatement * Process (const std::string query)
 

Detailed Description

Definition at line 9 of file DbSvc.h.

Member Enumeration Documentation

Enumerator
DB1 
DB2 
DB3 
DB01 
UIUC 
LITE 
LOCAL 

Definition at line 11 of file DbSvc.h.

Enumerator
Guest 
Prod 

Definition at line 12 of file DbSvc.h.

Constructor & Destructor Documentation

DbSvc::DbSvc ( const SvrId_t  svr_id = DB1,
const UsrId_t  usr_id = Guest,
const std::string  my_cnf = "" 
)

Definition at line 39 of file DbSvc.cc.

References ExpandEnvironmentals(), FileExist(), and LogInfo.

+ Here is the call graph for this function:

DbSvc::DbSvc ( const SvrId_t  svr_id,
std::string  dbfile 
)
explicit

Definition at line 59 of file DbSvc.cc.

References ExpandEnvironmentals(), FileExist(), and LogInfo.

+ Here is the call graph for this function:

DbSvc::~DbSvc ( )

Definition at line 77 of file DbSvc.cc.

Member Function Documentation

TSQLServer* DbSvc::Con ( )
inline
void DbSvc::CreateTable ( const std::string  name,
const std::vector< std::string >  list_var,
const std::vector< std::string >  list_type,
const std::vector< std::string >  list_key 
)

Definition at line 132 of file DbSvc.cc.

Referenced by DecoStatusDb::InitTable(), ChanMapScaler::WriteDbTable(), CalibParamXT::WriteDbTable(), CalibParamInTimeTaiwan::WriteDbTable(), ChanMapTaiwan::WriteDbTable(), CalibParamInTimeV1495::WriteDbTable(), ChanMapV1495::WriteDbTable(), GeomParamPlane::WriteDbTable(), and ParamRunRange::WriteToDB().

+ Here is the caller graph for this function:

void DbSvc::CreateTable ( const std::string  name,
const int  n_var,
const char **  list_var,
const char **  list_type,
const int  n_key = 0,
const char **  list_key = 0 
)

Definition at line 165 of file DbSvc.cc.

void DbSvc::CreateTable ( const std::string  name,
const VarList  list 
)

Definition at line 180 of file DbSvc.cc.

References DbSvc::VarList::Get(), and DbSvc::VarList::Size().

+ Here is the call graph for this function:

void DbSvc::DropTable ( const char *  name)

Definition at line 112 of file DbSvc.cc.

Referenced by DecoStatusDb::InitTable(), ParamRunRange::WriteToDB(), and RunParamBase::WriteToDB().

+ Here is the caller graph for this function:

void DbSvc::DropTable ( const std::string  name)
inline

Definition at line 31 of file DbSvc.h.

References DropTable().

Referenced by DropTable().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool DbSvc::HasTable ( const char *  name,
const bool  exit_on_false = false 
)

Definition at line 122 of file DbSvc.cc.

Referenced by DecoStatusDb::InitTable(), ParamRunRange::ReadFromDB(), and RunParamBase::ReadFromDB().

+ Here is the caller graph for this function:

bool DbSvc::HasTable ( const std::string  name,
const bool  exit_on_false = false 
)
inline

Definition at line 33 of file DbSvc.h.

References HasTable().

Referenced by HasTable().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TSQLStatement * DbSvc::Process ( const char *  query)

This function runs Statement(), Process() and StoreResult() with error check. The return object (TSQLStatement*) must be deleted by user. Example: TSQLStatement* stmt = db_svc->Process(query); while (stmt->NextResultRow()) { int id = stmt->GetInt(0); int event = stmt->GetInt(1); } delete stmt;

Definition at line 206 of file DbSvc.cc.

Referenced by SQG4DipoleMagnetDetector::Construct(), ChanMapScaler::ReadDbTable(), CalibParamInTimeTaiwan::ReadDbTable(), CalibParamXT::ReadDbTable(), CalibParamInTimeV1495::ReadDbTable(), ChanMapTaiwan::ReadDbTable(), ChanMapV1495::ReadDbTable(), GeomParamPlane::ReadDbTable(), and ParamRunRange::ReadFromDB().

+ Here is the caller graph for this function:

TSQLStatement* DbSvc::Process ( const std::string  query)
inline

Definition at line 40 of file DbSvc.h.

References Process().

Referenced by Process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DbSvc::UseSchema ( const char *  name,
const bool  do_create = false,
const bool  do_drop = false 
)

Definition at line 82 of file DbSvc.cc.

Referenced by DecoError::AggregateData(), DecoStatusDb::DecoStatusDb(), ParamRunRange::ReadFromDB(), RunParamBase::ReadFromDB(), ParamRunRange::WriteToDB(), and RunParamBase::WriteToDB().

+ Here is the caller graph for this function:

void DbSvc::UseSchema ( const std::string  name,
const bool  do_create = false,
const bool  do_drop = false 
)
inline

Definition at line 28 of file DbSvc.h.

References UseSchema().

Referenced by UseSchema().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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