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
27
class
MySQLConnection
;
28
class
PreparedStatementBase
;
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.
33
class
TC_DATABASE_API
MySQLPreparedStatement
34
{
35
friend
class
MySQLConnection
;
36
friend
class
PreparedStatementBase
;
37
38
public
:
39
MySQLPreparedStatement
(
MySQLStmt
* stmt, std::string queryString);
40
~MySQLPreparedStatement
();
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; }
57
PreparedStatementBase
*
m_stmt
;
58
void
ClearParameters();
59
void
AssertValidIndex(
uint8
index);
60
std::string getQueryString()
const
;
61
62
private
:
63
MySQLStmt
*
m_Mstmt
;
64
uint32
m_paramCount
;
65
std::vector<bool>
m_paramsSet
;
66
MySQLBind
*
m_bind
;
67
std::string
const
m_queryString
;
68
69
MySQLPreparedStatement
(
MySQLPreparedStatement
const
& right) =
delete
;
70
MySQLPreparedStatement
&
operator=
(
MySQLPreparedStatement
const
& right) =
delete
;
71
};
72
73
#endif
// MySQLPreparedStatement_h__
DatabaseEnvFwd.h
Define.h
uint8
uint8_t uint8
Definition
Define.h:156
TC_DATABASE_API
#define TC_DATABASE_API
Definition
Define.h:111
uint32
uint32_t uint32
Definition
Define.h:154
Duration.h
SystemTimePoint
std::chrono::system_clock::time_point SystemTimePoint
Definition
Duration.h:41
MySQLConnection
Definition
MySQLConnection.h:52
MySQLPreparedStatement
Definition
MySQLPreparedStatement.h:34
MySQLPreparedStatement::m_bind
MySQLBind * m_bind
Definition
MySQLPreparedStatement.h:66
MySQLPreparedStatement::m_stmt
PreparedStatementBase * m_stmt
Definition
MySQLPreparedStatement.h:57
MySQLPreparedStatement::operator=
MySQLPreparedStatement & operator=(MySQLPreparedStatement const &right)=delete
MySQLPreparedStatement::m_Mstmt
MySQLStmt * m_Mstmt
Definition
MySQLPreparedStatement.h:63
MySQLPreparedStatement::GetParameterCount
uint32 GetParameterCount() const
Definition
MySQLPreparedStatement.h:44
MySQLPreparedStatement::m_queryString
std::string const m_queryString
Definition
MySQLPreparedStatement.h:67
MySQLPreparedStatement::GetSTMT
MySQLStmt * GetSTMT()
Definition
MySQLPreparedStatement.h:55
MySQLPreparedStatement::m_paramCount
uint32 m_paramCount
Definition
MySQLPreparedStatement.h:64
MySQLPreparedStatement::MySQLPreparedStatement
MySQLPreparedStatement(MySQLPreparedStatement const &right)=delete
MySQLPreparedStatement::m_paramsSet
std::vector< bool > m_paramsSet
Definition
MySQLPreparedStatement.h:65
MySQLPreparedStatement::GetBind
MySQLBind * GetBind()
Definition
MySQLPreparedStatement.h:56
PreparedStatementBase
Definition
PreparedStatement.h:65
MySQLBind
Definition
MySQLHacks.h:27
MySQLStmt
Definition
MySQLHacks.h:28
server
database
Database
MySQLPreparedStatement.h
Generated on Sun May 10 2026 02:08:51 for TrinityCore by
1.9.8