AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
sqlite3Connection.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++23 standard
3 Copyright (C) 2012 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <https://www.gnu.org/licenses/>.
19*/
20#ifdef ANCH_SQL_SQLITE3
21#pragma once
22
23#include "anch-sqlite-export.hpp"
24
25#include "sql/connection.hpp"
26
27#include "sqlite3.h"
28
29
30namespace anch::sql::sqlite {
31
41 ANCH_SQLITE_EXPORT bool isFatal(int code) noexcept;
42
54 ANCH_SQLITE_EXPORT SqlException error(const std::string& message, sqlite3* conn, int code);
55
56} // anch::sql::sqlite
57
58namespace anch::sql {
59
69 class ANCH_SQLITE_EXPORT SQLite3Connection: public Connection {
70
71 // Attributes +
72 private:
74 sqlite3* _conn;
75 // Attributes -
76
77 // Constructors +
78 public:
86 SQLite3Connection(const std::string& database);
87
96
101 // Constructors -
102
103 // Destructor +
107 virtual ~SQLite3Connection() noexcept;
108 // Destructor -
109
110 // Methods +
111 protected:
121 virtual ResultSet* executeQuery(const std::string& query) override;
122
132 virtual uint64_t executeUpdate(const std::string& query) override;
133
139 virtual void sendCommit() override;
140
146 virtual void sendRollback() override;
147
153 virtual void sendStartTransaction() override;
154
164 virtual PreparedStatement* makePrepared(const std::string& query) override;
165 // Methods -
166
167 };
168
169} // anch::sql
170
171#endif // ANCH_SQL_SQLITE3
ResultSet * query(const std::string &query)
Connection(std::size_t statementCacheSize=DEFAULT_STATEMENT_CACHE_SIZE)
SQLite3Connection(const SQLite3Connection &)=delete
virtual void sendRollback() override
virtual uint64_t executeUpdate(const std::string &query) override
virtual PreparedStatement * makePrepared(const std::string &query) override
SQLite3Connection(const SqlConnectionConfiguration &config)
virtual ResultSet * executeQuery(const std::string &query) override
SQLite3Connection(const std::string &database)
virtual void sendStartTransaction() override
virtual ~SQLite3Connection() noexcept
virtual void sendCommit() override
SQL namespace.
Definition clauses.hpp:28
SQL database connection configuration.
Definition connection.hpp:55