StormByte C++ Library: Database module 0.0.9999
StormByte-Database is a StormByte library module for handling database connections
Loading...
Searching...
No Matches
prepared_stmt.hxx
1#pragma once
2
3#include <StormByte/database/prepared_stmt.hxx>
4#include <vector>
5#include <string>
6#include <memory>
7#include <StormByte/database/value.hxx>
8
9struct st_mysql;
10struct st_mysql_stmt;
11
16namespace StormByte::Database::MariaDB {
17 class MariaDB;
18
23 class STORMBYTE_DATABASE_PUBLIC PreparedSTMT final: public StormByte::Database::PreparedSTMT {
24 friend class ::StormByte::Database::MariaDB::MariaDB;
25 public:
30 PreparedSTMT(const PreparedSTMT& other) = delete;
31
36 PreparedSTMT(PreparedSTMT&& other) noexcept = default;
37
41 ~PreparedSTMT() noexcept override;
42
48 PreparedSTMT& operator=(const PreparedSTMT& other) = delete;
49
55 PreparedSTMT& operator=(PreparedSTMT&& other) noexcept = default;
56
57 private:
58 struct st_mysql* m_conn;
59 struct st_mysql_stmt* m_stmt;
60 std::vector<StormByte::Database::Value> m_params;
61
68 PreparedSTMT(const std::string& name, const std::string& query, struct st_mysql* conn);
69
76 PreparedSTMT(std::string&& name, std::string&& query, struct st_mysql* conn) noexcept;
77
83 static void EnsureParamSize(std::vector<StormByte::Database::Value>& params, int index) noexcept;
84
90 void Bind(const int& index, const std::nullptr_t& value) noexcept override;
91
97 void Bind(const int& index, const int& value) noexcept override;
98
104 void Bind(const int& index, const unsigned int& value) noexcept override;
105
111 void Bind(const int& index, const int64_t& value) noexcept override;
112
118 void Bind(const int& index, const uint64_t& value) noexcept override;
119
125 void Bind(const int& index, const double& value) noexcept override;
126
132 void Bind(const int& index, bool value) noexcept override;
133
139 void Bind(const int& index, const std::string& value) noexcept override;
140
146 void Bind(const int& index, const std::vector<std::byte>& value) noexcept override;
147
152 StormByte::Database::ExpectedRows DoExecute() override;
153
157 void Reset() noexcept override;
158 };
159}
Forward declaration of MariaDB class.
Definition prepared_stmt.hxx:23
PreparedSTMT(PreparedSTMT &&other) noexcept=default
PreparedSTMT(const PreparedSTMT &other)=delete
Prepared statement for databases.
Definition prepared_stmt.hxx:14
Value class for databases.
Definition value.hxx:20
Contains classes and functions for database operations.
All the classes for handling MariaDB databases.