AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
postgresqlPreparedStatement.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_POSTGRESQL
21#pragma once
22
23#include "anch-postgresql-export.hpp"
24
25#include "sql/preparedStatement.hpp"
26#include "sql/postgresqlConnection.hpp"
27
28#include <atomic>
29
30typedef struct pg_conn PGconn;
31
32
33namespace anch::sql {
34
36
46 class ANCH_POSTGRESQL_EXPORT PostgreSQLPreparedStatement: public PreparedStatement {
47
48 // Attributes +
49 private:
51 static std::atomic<std::uint64_t> _counter;
52
54 PGconn* _conn;
55
57 std::string _stmtId;
58 // Attributes -
59
60 // Constructors +
61 public:
70 PostgreSQLPreparedStatement(PGconn* dbCon, const std::string& query);
71 // Constructors -
72
73 // Destructor +
74 public:
78 virtual ~PostgreSQLPreparedStatement() noexcept;
79 // Destructor -
80
81 // Methods +
82 protected:
90 virtual void doPrepare(const std::string& query) override;
91
99 virtual ResultSet* doExecuteQuery() override;
100
108 virtual uint64_t doExecuteUpdate() override;
109
115 virtual void deallocate() noexcept override;
116 // Methods -
117
118 };
119
120} // anch::sql
121
122#endif // ANCH_SQL_POSTGRESQL
PostgreSQL connection.
Definition postgresqlConnection.hpp:84
virtual ResultSet * doExecuteQuery() override
virtual ~PostgreSQLPreparedStatement() noexcept
virtual void deallocate() noexcept override
PostgreSQLPreparedStatement(PGconn *dbCon, const std::string &query)
virtual void doPrepare(const std::string &query) override
virtual uint64_t doExecuteUpdate() override
SQL namespace.
Definition clauses.hpp:28