FOSSology  4.4.0
Open Source License Compliance by Open Source Software
libfossdbmanagerclass.hpp
Go to the documentation of this file.
1 /*
2  Author: Johannes Najjar, Cedric Bodet, Andreas Wuerl, Daniele Fognini
3  SPDX-FileCopyrightText: © 2014 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 #ifndef LIBFOSSDBMANAGERCLASS_HPP_
9 #define LIBFOSSDBMANAGERCLASS_HPP_
10 
11 #include "libfossdbmanager.h"
12 
13 #include <cstdarg>
14 #include <vector>
15 #include <string>
16 
17 
18 #include "libfossdbQueryResult.hpp"
19 
25 namespace fo
26 {
32  {
33  public:
39  {
40  fo_dbManager_finish(d);
41  }
42  };
43 
48  class DbManager
49  {
50  public :
51  DbManager(int* argc, char** argv);
53 
54  PGconn* getConnection() const;
55  DbManager spawn() const;
56 
58  bool tableExists(const char* tableName) const;
59  bool sequenceExists(const char* name) const;
60  bool begin() const;
61  bool commit() const;
62  bool rollback() const;
63  void ignoreWarnings(bool) const;
64 
65  QueryResult queryPrintf(const char* queryFormat, ...) const;
67 
68  private:
69  unptr::shared_ptr <fo_dbManager> dbManager;
70  };
71 }
72 
73 #endif /* LIBFOSSDBMANAGERCLASS_HPP_ */
DB manager deleter (for shared pointer)
void operator()(fo_dbManager *d)
DB wrapper for agents.
QueryResult execPrepared(fo_dbManager_PreparedStatement *stmt,...) const
Execute a prepared statement with new parameters.
bool tableExists(const char *tableName) const
void ignoreWarnings(bool) const
QueryResult queryPrintf(const char *queryFormat,...) const
Execute a query in printf format.
unptr::shared_ptr< fo_dbManager > dbManager
Shared DB manager.
PGconn * getConnection() const
bool sequenceExists(const char *name) const
fo_dbManager * getStruct_dbManager() const
DbManager(int *argc, char **argv)
Constructor for DbManager.
DbManager spawn() const
Wrapper for DB result.
Wrapper for DB result.
fo namespace holds the FOSSology library functions.