TrinityCore
Loading...
Searching...
No Matches
MySQLPreparedStatement.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef MySQLPreparedStatement_h__
19#define MySQLPreparedStatement_h__
20
21#include "DatabaseEnvFwd.h"
22#include "Define.h"
23#include "Duration.h"
24#include <string>
25#include <vector>
26
27class MySQLConnection;
29
30//- Class of which the instances are unique per MySQLConnection
31//- access to these class objects is only done when a prepared statement task
32//- is executed.
34{
35 friend class MySQLConnection;
37
38 public:
39 MySQLPreparedStatement(MySQLStmt* stmt, std::string queryString);
41
42 void BindParameters(PreparedStatementBase* stmt);
43
44 uint32 GetParameterCount() const { return m_paramCount; }
45
46 protected:
47 void SetParameter(uint8 index, std::nullptr_t);
48 void SetParameter(uint8 index, bool value);
49 template<typename T>
50 void SetParameter(uint8 index, T value);
51 void SetParameter(uint8 index, SystemTimePoint value);
52 void SetParameter(uint8 index, std::string const& value);
53 void SetParameter(uint8 index, std::vector<uint8> const& value);
54
55 MySQLStmt* GetSTMT() { return m_Mstmt; }
56 MySQLBind* GetBind() { return m_bind; }
58 void ClearParameters();
59 void AssertValidIndex(uint8 index);
60 std::string getQueryString() const;
61
62 private:
65 std::vector<bool> m_paramsSet;
67 std::string const m_queryString;
68
71};
72
73#endif // MySQLPreparedStatement_h__
uint8_t uint8
Definition Define.h:156
#define TC_DATABASE_API
Definition Define.h:111
uint32_t uint32
Definition Define.h:154
std::chrono::system_clock::time_point SystemTimePoint
Definition Duration.h:41
PreparedStatementBase * m_stmt
MySQLPreparedStatement & operator=(MySQLPreparedStatement const &right)=delete
MySQLPreparedStatement(MySQLPreparedStatement const &right)=delete
std::vector< bool > m_paramsSet