Belle II Software development
PostgreSQLInterface.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#ifndef _Belle2_PostgreSQLInterface_hh
9#define _Belle2_PostgreSQLInterface_hh
10
11#include "daq/slc/database/DBInterface.h"
12#include "daq/slc/system/Mutex.h"
13
14typedef struct pg_conn PGconn;
15typedef struct pg_result PGresult;
16
17namespace Belle2 {
24
25 public:
26 PostgreSQLInterface(const std::string& host,
27 const std::string& database,
28 const std::string& user,
29 const std::string& password,
30 int port);
32 virtual ~PostgreSQLInterface() {}
33
34 public:
35 void connect() override;
36 bool isConnected() override;
37 void execute_imp(const char* command) override;
38 void close() override;
39 void clear() override;
40 DBRecordList loadRecords() override;
41 bool checkTable(const std::string& tablename) override;
42 DBFieldTypeList getTableContents(const std::string& tablename) override;
43
44 private:
45 PGconn* m_sq_conn;
46 PGresult* m_sq_result;
47 Mutex m_mutex;
48
49 };
50
52}
53
54#endif
Abstract base class for different kinds of events.