MIDSX 0.1
A x-ray transport code system for dosimetry
Loading...
Searching...
No Matches
data_access_object.h
1#ifndef DATAACCESSOBJECT_H
2#define DATAACCESSOBJECT_H
3
4#include <sqlite3.h>
5#include <string>
6#include <vector>
7#include <iostream>
8#include <utility>
9#include <exception>
10
14class DatabaseException : public std::exception {
15public:
16 explicit DatabaseException(std::string message);
17 const char* what() const noexcept override;
18private:
19 std::string msg_;
20};
21
26public:
32 explicit DataAccessObject(const std::string& db_name);
34
41 std::vector<std::string> executeQuery(const std::string& query);
42
43private:
44 sqlite3* db{};
45 static int callback(void* data, int argc, char** argv, char** azColName);
46};
47
48#endif //DATAACCESSOBJECT_H
Class which provides an interface to a SQLite database.
DataAccessObject(const std::string &db_name)
Constructor for the DataAccessObject class.
std::vector< std::string > executeQuery(const std::string &query)
Executes a query and returns the results as a vector of strings.
Exception class for database errors.