ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PgPostBankBackupManager.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PgPostBankBackupManager.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 // $Id: PgPostBankBackupManager.hh,v 1.8 2014/05/19 17:06:23 jinhuang Exp $
4 
13 #ifndef PDBCALPG_PGPOSTBANKBACKUPMANAGER_H
14 #define PDBCALPG_PGPOSTBANKBACKUPMANAGER_H
15 
16 #include <phool/PHTimeStamp.h>
17 
18 #include <iostream>
19 #include <string>
20 #include <vector>
21 
22 class PdbCalChan;
24 class TSQLStatement;
25 class TSQLPreparedStatement;
26 class TSQLResultSet;
27 
32 {
33  public:
34  PgPostBankBackupManager(const std::string &Tag = "");
35  virtual ~PgPostBankBackupManager();
36 
38  typedef std::vector<int> rid_list_t;
39 
40  public:
42  bool
43  isRIdExist(const std::string &bankName, int rid);
44 
46  int getTotalRowCount(const std::string &bankName);
47 
50  getListOfRId(const std::string &bankName,
51  const std::string &condition = "");
52 
57  fetchBank(const std::string &bankName, int rid);
58 
62  bool
64 
66  int commitAllBankfromTFile(const std::string &in_file);
67 
69  int fetchBank2TFile(const std::string &bankName, const rid_list_t &rid_list,
70  const std::string &out_file);
71 
73  int fetchAllBank2TFile(const std::string &bankName,
74  const std::string &record_selection, const std::string &out_file_base,
75  int splitting_limit = 100000);
76 
78  void
79  dumpTable(const std::string &bankName, std::ostream &out);
80 
83  int CleanTable(const std::string &bankName,
84  const PHTimeStamp &min_preserve_time = PHTimeStamp::PHFarFuture,
85  const bool do_delete = false, const std::string &log_file_name = "");
86 
88  virtual void
89  Verbosity(const int ival)
90  {
91  verbosity = ival;
92  }
93 
95  virtual int
96  Verbosity() const
97  {
98  return verbosity;
99  }
100 
101  static std::string
102  getBankBaseName(const std::string &bank_classname);
103 
105  static void
106  deleteSQLStatement(TSQLStatement *stmt);
107 
109  static void
110  deleteODBCPreparedStatement(TSQLPreparedStatement *stmt);
111 
113  static ULong_t
114  HashPdbCalChan(const PdbCalChan &c);
115 
116  protected:
118  SQLResultSet2BackupStorage(TSQLResultSet *rs, const std::string &table_name);
119 
122 
123  std::string tag;
124 };
125 
126 #endif /* PDBCAL_PG_PGPOSTBANKBACKUPMANAGER_H */