SNode.C
Loading...
Searching...
No Matches
MariaDBFreeResultCommand.cpp
Go to the documentation of this file.
1
/*
2
* SNode.C - a slim toolkit for network communication
3
* Copyright (C) Volker Christian <me@vchrist.at>
4
* 2020, 2021, 2022, 2023, 2024, 2025
5
* 2021, 2022 Daniel Flockert
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as published
9
* by the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
21
#
include
"database/mariadb/commands/async/MariaDBFreeResultCommand.h"
22
23
#
ifndef
DOXYGEN_SHOULD_SKIP_THIS
24
25
#
endif
/* DOXYGEN_SHOULD_SKIP_THIS */
26
27
namespace
database::
mariadb
::commands::
async
{
28
29
MariaDBFreeResultCommand
::
MariaDBFreeResultCommand
(MYSQL_RES*& result,
30
const
std::function<
void
(
void
)>& onFreeResult,
31
const
std::function<
void
(
const
std::string&,
unsigned
int
)>& onError)
32
:
MariaDBCommandASync
(
"FreeResult"
,
onError
)
33
,
result
(
result
)
34
,
onFreeResult
(
onFreeResult
) {
35
}
36
37
MariaDBFreeResultCommand
::~
MariaDBFreeResultCommand
() {
38
if
(result !=
nullptr
) {
39
mysql_free_result(result);
40
}
41
}
42
43
int
MariaDBFreeResultCommand
::
commandStart
() {
44
int
ret = 0;
45
46
if
(result !=
nullptr
) {
47
ret = mysql_free_result_start(result);
48
}
49
50
return
ret;
51
}
52
53
int
MariaDBFreeResultCommand
::
commandContinue
(
int
status) {
54
return
mysql_free_result_cont(result, status);
55
}
56
57
bool
MariaDBFreeResultCommand
::
commandCompleted
() {
58
onFreeResult();
59
60
result =
nullptr
;
61
62
return
true
;
63
}
64
65
void
MariaDBFreeResultCommand
::
commandError
(
const
std::string& errorString,
unsigned
int
errorNumber) {
66
onError(errorString, errorNumber);
67
}
68
69
}
// namespace database::mariadb::commands::async
database::mariadb::commands::async::MariaDBFreeResultCommand
Definition
MariaDBFreeResultCommand.h:32
database::mariadb::commands::async::MariaDBFreeResultCommand::commandCompleted
bool commandCompleted() override
Definition
MariaDBFreeResultCommand.cpp:57
database::mariadb::commands::async::MariaDBFreeResultCommand::commandStart
int commandStart() override
Definition
MariaDBFreeResultCommand.cpp:43
database::mariadb::commands::async::MariaDBFreeResultCommand::~MariaDBFreeResultCommand
~MariaDBFreeResultCommand() override
Definition
MariaDBFreeResultCommand.cpp:37
database::mariadb::commands::async::MariaDBFreeResultCommand::MariaDBFreeResultCommand
MariaDBFreeResultCommand(MYSQL_RES *&result, const std::function< void(void)> &onFreeResult, const std::function< void(const std::string &, unsigned int)> &onError)
Definition
MariaDBFreeResultCommand.cpp:29
database::mariadb::commands::async::MariaDBFreeResultCommand::commandError
void commandError(const std::string &errorString, unsigned int errorNumber) override
Definition
MariaDBFreeResultCommand.cpp:65
database::mariadb::commands::async::MariaDBFreeResultCommand::commandContinue
int commandContinue(int status) override
Definition
MariaDBFreeResultCommand.cpp:53
database::mariadb::commands
Definition
MariaDBAutoCommitCommand.cpp:27
database
Definition
MariaDBClient.h:39
database
mariadb
commands
async
MariaDBFreeResultCommand.cpp
Generated on Mon Feb 10 2025 20:20:56 for SNode.C by
1.11.0