CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SQLReport.cc
Go to the documentation of this file.
3 #include "RelationalAccess/IMonitoringReporter.h"
4 #include <fstream>
5 
6 constexpr char SQLREPORT_DEFAULT_FILENAME[] = "sqlreport.out";
7 
8 void cond::SQLReport::reportForConnection(const std::string& connectionString){
9  m_report << "-- connection: "<< connectionString << std::endl;
10  m_connection.monitoringReporter().reportToOutputStream( connectionString, m_report );
11 }
12 
14  std::ofstream outFile;
15  if(fileName.empty()) fileName.append(SQLREPORT_DEFAULT_FILENAME);
16  outFile.open(fileName.c_str());
17  if(!outFile.good()){
18  std::stringstream msg;
19  msg << "Cannot open the output file \""<<fileName<<"\"";
20  outFile.close();
21  throw cond::Exception(msg.str());
22  }
23  outFile << m_report.str();
24  outFile.flush();
25  outFile.close();
26  return true;
27 }
char SQLREPORT_DEFAULT_FILENAME[]
Definition: SQLReport.cc:6
std::stringstream m_report
Definition: SQLReport.h:29
const coral::IMonitoringReporter & monitoringReporter() const
DbConnection m_connection
Definition: SQLReport.h:27
#define constexpr
void reportForConnection(const std::string &connectionString)
Definition: SQLReport.cc:8
bool putOnFile(std::string fileName=std::string(""))
Definition: SQLReport.cc:13