REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Public Member Functions | Protected Attributes
TRestDataBase Class Reference

Detailed Description

Definition at line 82 of file TRestDataBase.h.

Public Member Functions

virtual DBTable exec (std::string cmd)
 return a table from query std::string cmd
 
virtual int get_lastrun ()
 get the latest run id in database More...
 
virtual void Initialize ()
 default: read the dataURL file
 
virtual void print (std::string cmd)
 print the table after query std::string cmd
 
virtual DBEntry query_data (DBEntry info)
 
virtual DBEntry query_run (int runnumber)
 
virtual DBFile query_run_file (int runnumber, int fileid)
 return file of certain file id in certain run
 
virtual std::vector< DBFile > query_run_files (int runnumber)
 return all the files of the run
 
virtual std::vector< int > search_run (DBEntry info)
 search runs according to the run info. return a list of run numbers
 
virtual std::vector< int > search_run_with_file (std::string filepattern)
 search runs according to the file name. return a list of run numbers
 
virtual int set_data (DBEntry info, bool overwrite=true)
 add/update a new record of metadata in database
 
virtual int set_run (DBEntry info, bool overwrite=true)
 add/update a run, with run info as struct DBEntry. returns the added run id More...
 
virtual int set_runfile (int runnumber, std::string filename)
 add/update a runfile to the specified run
 
virtual void test ()
 test function
 
 TRestDataBase ()
 default constructor, setting fConnectionString according to the env
 
 ~TRestDataBase ()
 destructor
 

Protected Attributes

std::string fConnectionString
 
std::vector< DBEntry > fDataEntries
 

Member Function Documentation

◆ get_lastrun()

int TRestDataBase::get_lastrun ( )
virtual

get the latest run id in database

get the latest run in database

Get the latest run in database, by reading the file: $REST_USER_PATH/runNumber. Note that this file saves run number of the next run. So it returns The run number -1.

Definition at line 154 of file TRestDataBase.cxx.

◆ query_data()

DBEntry TRestDataBase::query_data ( DBEntry  _info)
virtual

metadata management interface ////////////////////// return the piece of data in fMetadataEntries

The following specification of DBEntry's content means to match any: id <= 0, type == "" ,usr == "" ,tag == "" ,description == "" ,version == "". If all of them mean any, it will return a blank list.

Definition at line 209 of file TRestDataBase.cxx.

◆ query_run()

virtual DBEntry TRestDataBase::query_run ( int  runnumber)
inlinevirtual

run number management interface ////////////////////// return the run number of the run. If not exist, return 0

Definition at line 104 of file TRestDataBase.h.

◆ set_run()

int TRestDataBase::set_run ( DBEntry  info,
bool  overwrite = true 
)
virtual

add/update a run, with run info as struct DBEntry. returns the added run id

add a new run, with run info as struct DBEntry. returns the added run id

runs are added according to info.id of input DBEntry object: -1 --> do not add 0 --> append a new run in run list >0 --> directly use this run number, overwrite existing

It will write to the file: $REST_USER_PATH/runNumber is writable. The number written will be the next run number

The method in derived class shall follow this rule.

Definition at line 183 of file TRestDataBase.cxx.


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