Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
QueryResult.h
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#ifndef QUERYRESULT_H
7
#define QUERYRESULT_H
8
9
#include "
AutoPtr.h
"
10
11
#include "
Field.h
"
12
13
#ifdef _WIN32
14
#include <winsock2.h>
15
#endif
16
#include <mysql.h>
17
18
class
ResultSet
19
{
20
public
:
21
ResultSet
(MYSQL_RES* result, MYSQL_FIELD* fields,
uint64
rowCount,
uint32
fieldCount);
22
~ResultSet
();
23
24
bool
NextRow
();
25
uint64
GetRowCount
()
const
{
return
_rowCount
; }
26
uint32
GetFieldCount
()
const
{
return
_fieldCount
; }
27
28
Field
*
Fetch
()
const
{
return
_currentRow
; }
29
const
Field
&
operator []
(
uint32
index)
const
30
{
31
ASSERT
(index <
_fieldCount
);
32
return
_currentRow
[index];
33
}
34
35
protected
:
36
uint64
_rowCount
;
37
Field
*
_currentRow
;
38
uint32
_fieldCount
;
39
40
private
:
41
void
CleanUp
();
42
MYSQL_RES*
_result
;
43
MYSQL_FIELD*
_fields
;
44
ResultSet
(
ResultSet
const
& right) =
delete
;
45
ResultSet
&
operator=
(
ResultSet
const
& right) =
delete
;
46
};
47
48
typedef
Skyfire::AutoPtr<ResultSet, Skyfire::Mutex>
QueryResult
;
49
50
class
PreparedResultSet
51
{
52
public
:
53
PreparedResultSet
(MYSQL_STMT* stmt, MYSQL_RES* result,
uint64
rowCount,
uint32
fieldCount);
54
~PreparedResultSet
();
55
56
bool
NextRow
();
57
uint64
GetRowCount
()
const
{
return
m_rowCount
; }
58
uint32
GetFieldCount
()
const
{
return
m_fieldCount
; }
59
60
Field
*
Fetch
()
const
61
{
62
ASSERT
(
m_rowPosition
<
m_rowCount
);
63
return
m_rows
[
uint32
(
m_rowPosition
)];
64
}
65
66
const
Field
&
operator []
(
uint32
index)
const
67
{
68
ASSERT
(
m_rowPosition
<
m_rowCount
);
69
ASSERT
(index <
m_fieldCount
);
70
return
m_rows
[
uint32
(
m_rowPosition
)][index];
71
}
72
73
protected
:
74
std::vector<Field*>
m_rows
;
75
uint64
m_rowCount
;
76
uint64
m_rowPosition
;
77
uint32
m_fieldCount
;
78
79
private
:
80
MYSQL_BIND*
m_rBind
;
81
MYSQL_STMT*
m_stmt
;
82
MYSQL_RES*
m_res
;
83
84
bool
*
m_isNull
;
85
unsigned
long
*
m_length
;
86
87
void
FreeBindBuffer
();
88
void
CleanUp
();
89
bool
_NextRow
();
90
PreparedResultSet
(
PreparedResultSet
const
& right) =
delete
;
91
PreparedResultSet
&
operator=
(
PreparedResultSet
const
& right) =
delete
;
92
};
93
94
typedef
Skyfire::AutoPtr<PreparedResultSet, Skyfire::Mutex>
PreparedQueryResult
;
95
96
#endif
97
AutoPtr.h
uint32
std::uint32_t uint32
Definition
Define.h:77
uint64
std::uint64_t uint64
Definition
Define.h:76
ASSERT
#define ASSERT
Definition
Errors.h:29
Field.h
PreparedQueryResult
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Definition
QueryResult.h:94
QueryResult
Skyfire::AutoPtr< ResultSet, Skyfire::Mutex > QueryResult
Definition
QueryResult.h:48
Field
Definition
Field.h:16
PreparedResultSet::m_rowPosition
uint64 m_rowPosition
Definition
QueryResult.h:76
PreparedResultSet::CleanUp
void CleanUp()
Definition
QueryResult.cpp:209
PreparedResultSet::NextRow
bool NextRow()
Definition
QueryResult.cpp:166
PreparedResultSet::m_rowCount
uint64 m_rowCount
Definition
QueryResult.h:75
PreparedResultSet::PreparedResultSet
PreparedResultSet(PreparedResultSet const &right)=delete
PreparedResultSet::_NextRow
bool _NextRow()
Definition
QueryResult.cpp:176
PreparedResultSet::~PreparedResultSet
~PreparedResultSet()
Definition
QueryResult.cpp:133
PreparedResultSet::GetFieldCount
uint32 GetFieldCount() const
Definition
QueryResult.h:58
PreparedResultSet::m_fieldCount
uint32 m_fieldCount
Definition
QueryResult.h:77
PreparedResultSet::m_rows
std::vector< Field * > m_rows
Definition
QueryResult.h:74
PreparedResultSet::GetRowCount
uint64 GetRowCount() const
Definition
QueryResult.h:57
PreparedResultSet::Fetch
Field * Fetch() const
Definition
QueryResult.h:60
PreparedResultSet::operator[]
const Field & operator[](uint32 index) const
Definition
QueryResult.h:66
PreparedResultSet::m_stmt
MYSQL_STMT * m_stmt
Definition
QueryResult.h:81
PreparedResultSet::operator=
PreparedResultSet & operator=(PreparedResultSet const &right)=delete
PreparedResultSet::FreeBindBuffer
void FreeBindBuffer()
Definition
QueryResult.cpp:221
PreparedResultSet::PreparedResultSet
PreparedResultSet(MYSQL_STMT *stmt, MYSQL_RES *result, uint64 rowCount, uint32 fieldCount)
Definition
QueryResult.cpp:19
PreparedResultSet::m_rBind
MYSQL_BIND * m_rBind
Definition
QueryResult.h:80
PreparedResultSet::m_isNull
bool * m_isNull
Definition
QueryResult.h:84
PreparedResultSet::m_length
unsigned long * m_length
Definition
QueryResult.h:85
PreparedResultSet::m_res
MYSQL_RES * m_res
Definition
QueryResult.h:82
ResultSet::_fieldCount
uint32 _fieldCount
Definition
QueryResult.h:38
ResultSet::_currentRow
Field * _currentRow
Definition
QueryResult.h:37
ResultSet::_rowCount
uint64 _rowCount
Definition
QueryResult.h:36
ResultSet::GetRowCount
uint64 GetRowCount() const
Definition
QueryResult.h:25
ResultSet::CleanUp
void CleanUp()
Definition
QueryResult.cpp:194
ResultSet::_result
MYSQL_RES * _result
Definition
QueryResult.h:42
ResultSet::NextRow
bool NextRow()
Definition
QueryResult.cpp:139
ResultSet::Fetch
Field * Fetch() const
Definition
QueryResult.h:28
ResultSet::operator[]
const Field & operator[](uint32 index) const
Definition
QueryResult.h:29
ResultSet::ResultSet
ResultSet(MYSQL_RES *result, MYSQL_FIELD *fields, uint64 rowCount, uint32 fieldCount)
Definition
QueryResult.cpp:9
ResultSet::~ResultSet
~ResultSet()
Definition
QueryResult.cpp:128
ResultSet::GetFieldCount
uint32 GetFieldCount() const
Definition
QueryResult.h:26
ResultSet::_fields
MYSQL_FIELD * _fields
Definition
QueryResult.h:43
ResultSet::ResultSet
ResultSet(ResultSet const &right)=delete
ResultSet::operator=
ResultSet & operator=(ResultSet const &right)=delete
Skyfire::AutoPtr
Definition
AutoPtr.h:16
src
server
shared
Database
QueryResult.h
Generated on
for Project SkyFire Core by
1.17.0