26#ifndef SQLITE_HAS_CODEC
27#define SQLITE_HAS_CODEC
35#include <unordered_map>
57 SqliteDatabase(
const std::filesystem::path& path,
int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
72 const std::filesystem::path&
getPath() const noexcept;
90 bool unlock(const std::
string& password) noexcept;
124 bool execute(const std::
string& command) noexcept;
134 mutable std::mutex m_mutex;
135 std::filesystem::path m_path;
~SqliteDatabase() noexcept
Destructs a SqliteDatabase.
SqliteStatement createStatement(const std::string &command)
Creates a new SqlStatement for the database.
bool unlock(const std::string &password) noexcept
Unlocks the database.
const std::filesystem::path & getPath() const noexcept
Gets the path of the database file.
SqliteDatabase(SqliteDatabase &&other) noexcept
Constructs a SqliteDatabase via move.
bool isEncrypted() const noexcept
Gets whether or not the database is encrypted.
bool registerFunction(const std::string &name, const SqliteCustomFunction &func, int expectedArgs=-1) noexcept
Registers a custom sql function to the database.
SqliteDatabase(const std::filesystem::path &path, int flags=SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE)
Constructs a SqliteDatabase.
bool execute(const std::string &command) noexcept
Executes a sql command on the database.
bool setPassword(const std::string &password)
Sets the database's password.
SqliteDatabase(const SqliteDatabase &)=delete
bool isUnlocked() const noexcept
Gets whether or not the database is unlocked.
A sqlite function context.
Definition sqlitefunctioncontext.h:36
A sqlite statement.
Definition sqlitestatement.h:35
std::function< void(SqliteFunctionContext &)> SqliteCustomFunction
Definition sqlitedatabase.h:42