FOSSology  4.4.0
Open Source License Compliance by Open Source Software
databasehandler.hpp
1 /*
2  SPDX-FileCopyrightText: © 2014-2015 Siemens AG
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
7 #ifndef NINKA_AGENT_DATABASE_HANDLER_HPP
8 #define NINKA_AGENT_DATABASE_HANDLER_HPP
9 
10 #include <string>
11 #include <vector>
12 #include <unordered_map>
15 
17 {
18 public:
21  NinkaDatabaseHandler spawn() const;
22 
23  std::vector<unsigned long> queryFileIdsForUpload(int uploadId);
24  bool saveLicenseMatch(int agentId, long pFileId, long licenseId, unsigned percentMatch);
25 
26  void insertOrCacheLicenseIdForName(std::string const& rfShortName);
27  unsigned long getCachedLicenseIdForName(std::string const& rfShortName) const;
28 
29 private:
30  unsigned long selectOrInsertLicenseIdForName(std::string rfShortname);
31 
32  std::unordered_map<std::string,long> licenseRefCache;
33 };
34 
35 #endif // NINKA_AGENT_DATABASE_HANDLER_HPP
Database handler for agents.
DbManager dbManager
DbManager to use.
DB wrapper for agents.
DB utility functions for agents.
DB wrapper for agents.