AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
postgresqlResultSet.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/resultSet.hpp"
26
27
28typedef struct pg_conn PGconn;
29typedef struct pg_result PGresult;
30
31
32namespace anch::sql {
33
43 class ANCH_POSTGRESQL_EXPORT PostgreSQLResultSet: public ResultSet {
44
45 // Attributes +
46 private:
48 PGconn* _conn;
49
51 PGresult* _result;
52
54 int _currentRow;
55
57 int _nbRows;
58
60 int _nbFields;
61 // Attributes -
62
63 // Constructors +
64 public:
70 PostgreSQLResultSet(PGconn* conn) noexcept;
71 // Constructors -
72
73 // Destructor +
74 public:
78 virtual ~PostgreSQLResultSet() noexcept;
79 // Destructor -
80
81 // Methods +
82 protected:
90 virtual bool fetchNext() override;
91
92 protected:
101 virtual bool getValue(std::size_t idx, std::string& out) override;
102
112 virtual std::optional<std::string> getValue(std::size_t idx) override;
113
119 virtual const anch::date::DateFormatter& getTimestampFormatter() override;
120 // Methods -
121
122 };
123
124} // anch::sql
125
126#endif // ANCH_SQL_POSTGRESQL
virtual const anch::date::DateFormatter & getTimestampFormatter() override
PostgreSQLResultSet(PGconn *conn) noexcept
virtual bool getValue(std::size_t idx, std::string &out) override
virtual bool fetchNext() override
virtual ~PostgreSQLResultSet() noexcept
Dates namespace.
SQL namespace.
Definition clauses.hpp:28
AnCH framework base namespace.
Definition app.hpp:30