qswiki/database/sqlite.h

33 líneas
807 B
C
Original Vista normal Histórico

2018-11-03 17:12:20 +01:00
#ifndef SQLITE_H
#define SQLITE_H
#include <string>
#include <sqlite3.h>
#include <sqlite_modern_cpp.h>
#include "database.h"
class Sqlite : public Database
{
private:
bool inTransaction = false;
std::shared_ptr<sqlite::database> db;
template <class T> std::unique_ptr<T> create() const
{
return std::make_unique<T>(db);
}
public:
Sqlite(std::string path);
std::unique_ptr<PageDao> createPageDao() const;
std::unique_ptr<RevisionDao> createRevisionDao() const;
std::unique_ptr<UserDao> createUserDao() const;
std::unique_ptr<SessionDao> createSessionDao() const;
std::unique_ptr<CategoryDao> createCategoryDao() const;
std::unique_ptr<PermissionsDao> createPermissionsDao() const;
2018-11-03 17:12:20 +01:00
void beginTransaction();
void commitTransaction();
void rollbackTransaction();
};
#endif // SQLITE_H