StormByte C++ Library: Database module 0.0.9999
StormByte-Database is a StormByte library module for handling database connections
Loading...
Searching...
No Matches
sqlite3.hxx
1#pragma once
2
3#include <StormByte/database/database.hxx>
4#include <StormByte/database/sqlite/preparedSTMT.hxx>
5#include <StormByte/database/sqlite/query.hxx>
6#include <StormByte/database/sqlite/exception.hxx>
7
8#include <filesystem>
9#include <list>
10#include <map>
11#include <memory>
12
13class sqlite3; // Forward declaration so we don't have to depend on sqlite3 headers
18namespace StormByte::Database::SQLite {
23 class STORMBYTE_DATABASE_PUBLIC SQLite3: public Database<Query, PreparedSTMT> {
24 public:
28 SQLite3(const SQLite3& db) = delete;
29
33 SQLite3(SQLite3&& db) noexcept = default;
34
38 SQLite3& operator=(const SQLite3& db) = delete;
39
43 SQLite3& operator=(SQLite3&& db) noexcept = default;
44
48 virtual ~SQLite3() noexcept;
49
50 protected:
55
60 SQLite3(const std::filesystem::path& dbfile);
61
66 SQLite3(std::filesystem::path&& dbfile);
67
71 void Connect() override;
72
76 void Disconnect() override;
77
82 const std::string LastError() const override;
83
84 private:
88 std::filesystem::path m_database_file;
89
94 sqlite3* m_database;
95
99 void EnableForeignKeys();
100
104 void InternalDisconnect();
105
112 std::unique_ptr<PreparedSTMT> InternalPrepare(const std::string& name, const std::string& query) override;
113
119 std::unique_ptr<Query> InternalQuery(const std::string& query) override;
120 };
121}
Prepared statement for SQLite.
Definition preparedSTMT.hxx:16
Represents a query to be executed in a SQLite3 database. In SQLite3 a query is a Prepared Statement s...
Definition query.hxx:17
SQLite3 & operator=(const SQLite3 &db)=delete
SQLite3(SQLite3 &&db) noexcept=default
SQLite3(const SQLite3 &db)=delete
SQLite3 & operator=(SQLite3 &&db) noexcept=default
Contains classes and functions for database operations.
Contains classes and functions for SQLite3 database operations.