Class SessionDB

Nested Relationships

Nested Types

Class Documentation

class SessionDB

Public Functions

inline void setDBFilePath(std::filesystem::path session_file_name)
inline const std::filesystem::path &getDBFilePath() const
bool writePropertiesHandler(const IPropertiesHandler &properties_handler)

Writes a IPropertiesHandler to the Session DB file.

Returns

false if write failed.

bool readPropertiesHandler(IPropertiesHandler &properties_handler)

Reads a IPropertiesHandler from the Session DB file.

Returns

false if read failed.

template<typename Value, typename ...Args>
std::optional<DBContext> beginRead(const std::string &table_name, const Value &value, const Args&... args)
template<typename WhereValue, typename Value, typename ...Args>
std::optional<SessionDB::DBContext> beginReadWhere(const std::string &table_name, const std::string &where_id, const WhereValue &where_value, const Value &value, const Args&... args)
template<typename ...Args>
bool read(SessionDB::DBContext &db_context, Args&... args)
void endRead(SessionDB::DBContext &db_context)
template<typename Value, typename ...Args>
std::optional<DBContext> beginWrite(const std::string &table_name, const Value &value, const char *value_type, const Args&... args)
template<typename Value, typename ...Args>
void write(SessionDB::DBContext &db_context, const Value &value, const Args&... args)
void endWrite(SessionDB::DBContext &db_context)
int64_t getLastInsertedRowId(SessionDB::DBContext &db_context) const

Protected Functions

template<typename Value, typename ...Args>
void beginRead(std::ostringstream &os, std::vector<std::string> &columns, const Value &value, const Args&... args)
template<typename Value>
void beginRead(std::ostringstream &os, std::vector<std::string> &columns, const Value &value)
template<typename Value, typename ...Args>
void beginWrite(std::ostringstream &os, std::vector<std::string> &columns, const Value &value, const char *value_type, const Args&... args)
template<typename Value>
void beginWrite(std::ostringstream &os, std::vector<std::string> &columns, const Value &value, const char *value_type)
template<typename Value, typename ...Args>
void write(std::ostringstream &os, SessionDB::DBContext &db_context, const Value &value, const Args&... args)
template<typename Value>
void write(std::ostringstream &os, SessionDB::DBContext &db_context, const Value &value)
template<typename Value, typename ...Args>
void readRowFromDB(SessionDB::DBContext &db_context, int column, Value &value, Args&... args)
template<typename Value>
void readRowFromDB(SessionDB::DBContext &db_context, int column, Value &value)
std::optional<sqlite3*> openSessionDB()
void closeSessionDB(sqlite3 *db)
void updateSessionInfo(sqlite3 *db)
void displaySessionInfo()
void writeSessionInfo(sqlite3 *db)
void logSQLError(const std::string &error_message, const std::string &sql_command = "") const

Protected Attributes

std::filesystem::path session_file_name_
std::string smartpeak_version_ = "Unknown"
bool session_info_logged_ = false
struct DBContext

Public Members

sqlite3 *db = nullptr
std::vector<std::string> columns
std::string table
sqlite3_stmt *stmt = nullptr