AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
postgresqlResultSet.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 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 <http://www.gnu.org/licenses/>.
19*/
20#ifdef ANCH_SQL_POSTGRESQL
21#pragma once
22
23#include "sql/resultSet.hpp"
24
25
26typedef struct pg_conn PGconn;
27typedef struct pg_result PGresult;
28
29
30namespace anch {
31 namespace sql {
32
43
44 // Attributes +
45 private:
47 PGconn* _conn;
48
50 PGresult* _result;
51
53 int _currentRow;
54
56 int _nbRows;
57
59 int _nbFields;
60 // Attributes -
61
62 // Constructors +
63 public:
69 PostgreSQLResultSet(PGconn* conn) noexcept;
70 // Constructors -
71
72 // Destructor +
73 public:
77 virtual ~PostgreSQLResultSet() noexcept;
78 // Destructor -
79
80 // Methods +
81 public:
89 virtual bool next();
90
91 protected:
100 virtual bool getValue(std::size_t idx, std::string& out) override;
101
111 virtual std::optional<std::string> getValue(std::size_t idx) override;
112
118 virtual const anch::date::DateFormatter& getDateFormatter() override;
119
125 virtual const anch::date::DateFormatter& getTimeFormatter() override;
126
132 virtual const anch::date::DateFormatter& getTimestampFormatter() override;
133 // Methods -
134
135 };
136
137 }
138}
139
140#endif // ANCH_SQL_POSTGRESQL
virtual const anch::date::DateFormatter & getTimestampFormatter() override
virtual const anch::date::DateFormatter & getTimeFormatter() override
PostgreSQLResultSet(PGconn *conn) noexcept
virtual bool getValue(std::size_t idx, std::string &out) override
virtual ~PostgreSQLResultSet() noexcept
virtual const anch::date::DateFormatter & getDateFormatter() override
Date namespace.
SQL namespace.
Definition clauses.hpp:26
AnCH framework base namespace.
Definition app.hpp:28