FOSSology  3.2.0rc1
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  Copyright (C) 2014, Siemens AG
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License version 2
7  as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty
11  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  See the GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software Foundation,
16  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef LIBFOSSDBMANAGERCLASS_HPP_
20 #define LIBFOSSDBMANAGERCLASS_HPP_
21 
22 extern "C" {
23 #include "libfossdbmanager.h"
24 }
25 
26 #include <cstdarg>
27 #include <vector>
28 #include <string>
29 
30 
31 #include "libfossdbQueryResult.hpp"
32 
38 namespace fo
39 {
45  {
46  public:
52  {
53  fo_dbManager_finish(d);
54  }
55  };
56 
61  class DbManager
62  {
63  public :
64  DbManager(int* argc, char** argv);
66 
67  PGconn* getConnection() const;
68  DbManager spawn() const;
69 
70  fo_dbManager* getStruct_dbManager() const;
71  bool tableExists(const char* tableName) const;
72  bool sequenceExists(const char* name) const;
73  bool begin() const;
74  bool commit() const;
75  bool rollback() const;
76  void ignoreWarnings(bool) const;
77 
78  QueryResult queryPrintf(const char* queryFormat, ...) const;
79  QueryResult execPrepared(fo_dbManager_PreparedStatement* stmt, ...) const;
80 
81  private:
82  unptr::shared_ptr <fo_dbManager> dbManager;
83  };
84 }
85 
86 #endif /* LIBFOSSDBMANAGERCLASS_HPP_ */
DB wrapper for agents.
void operator()(fo_dbManager *d)
Wrapper for DB result.
DB manager deleter (for shared pointer)
Wrapper for DB result.
unptr::shared_ptr< fo_dbManager > dbManager
Shared DB manager.
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:28
fo namespace holds the FOSSology library functions.