AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
mysqlPreparedStatementResultSet.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_MYSQL
21#pragma once
22
23#include "anch-mysql-export.hpp"
24
25#include "mysql.h"
26#include "sql/resultSet.hpp"
27
28#include <list>
29#include <optional>
30#include <string>
31#include <vector>
32
33#ifndef LIBMARIADB
34typedef bool my_bool;
35#endif
36
37namespace anch::sql {
38
48 class ANCH_MYSQL_EXPORT MySQLPreparedStatementResultSet: public ResultSet {
49
50 // Attributes +
51 private:
53 MYSQL_STMT* _stmt;
54
56 std::vector<std::vector<char>> _buffers;
57
59 std::vector<std::optional<std::string>> _values;
60
62 std::vector<unsigned long> _lengths;
63
65 std::vector<my_bool> _nulls;
66
68 std::vector<my_bool> _errors;
69
71 std::vector<MYSQL_BIND> _binds;
72 // Attributes -
73
74 // Constructors +
75 public:
84 // Constructors -
85
86 // Destructor +
91 // Destructor -
92
93 // Methods +
94 protected:
102 virtual bool fetchNext() override;
103
104 protected:
113 virtual bool getValue(std::size_t idx, std::string& out) override;
114
124 virtual std::optional<std::string> getValue(std::size_t idx) override;
125
131 virtual const anch::date::DateFormatter& getTimestampFormatter() override;
132 // Methods -
133
134 };
135
136} // anch::sql
137
138#endif // ANCH_SQL_MYSQL
virtual bool getValue(std::size_t idx, std::string &out) override
virtual ~MySQLPreparedStatementResultSet() noexcept
virtual const anch::date::DateFormatter & getTimestampFormatter() override
Dates namespace.
SQL namespace.
Definition clauses.hpp:28
AnCH framework base namespace.
Definition app.hpp:30