SNode.C
Loading...
Searching...
No Matches
MariaDBAutoCommitCommand.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/MariaDBAutoCommitCommand.h"
22
23
#
ifndef
DOXYGEN_SHOULD_SKIP_THIS
24
25
#
endif
/* DOXYGEN_SHOULD_SKIP_THIS */
26
27
namespace
database::
mariadb
::commands::
async
{
28
29
MariaDBAutoCommitCommand
::
MariaDBAutoCommitCommand
(my_bool autoCommit,
30
const
std::function<
void
()>& onAutoCommit,
31
const
std::function<
void
(
const
std::string&,
unsigned
int
)>& onError)
32
:
MariaDBCommandASync
(
"AutoCommit"
,
onError
)
33
,
autoCommit
(
autoCommit
)
34
,
onAutoCommit
(
onAutoCommit
) {
35
}
36
37
int
MariaDBAutoCommitCommand
::
commandStart
() {
38
return
mysql_autocommit_start(&ret, mysql, autoCommit);
39
}
40
41
int
MariaDBAutoCommitCommand
::
commandContinue
(
int
status) {
42
return
mysql_autocommit_cont(&ret, mysql, status);
43
}
44
45
bool
MariaDBAutoCommitCommand
::
commandCompleted
() {
46
onAutoCommit();
47
48
return
true
;
49
}
50
51
void
MariaDBAutoCommitCommand
::
commandError
(
const
std::string& errorString,
unsigned
int
errorNumber) {
52
onError(errorString, errorNumber);
53
}
54
55
std::string
MariaDBAutoCommitCommand
::
commandInfo
() {
56
return
commandName() +
": AutoCommit = "
+ std::to_string(autoCommit);
57
}
58
59
}
// namespace database::mariadb::commands::async
database::mariadb::commands::async::MariaDBAutoCommitCommand
Definition
MariaDBAutoCommitCommand.h:32
database::mariadb::commands::async::MariaDBAutoCommitCommand::commandInfo
std::string commandInfo() override
Definition
MariaDBAutoCommitCommand.cpp:55
database::mariadb::commands::async::MariaDBAutoCommitCommand::commandStart
int commandStart() override
Definition
MariaDBAutoCommitCommand.cpp:37
database::mariadb::commands::async::MariaDBAutoCommitCommand::MariaDBAutoCommitCommand
MariaDBAutoCommitCommand(my_bool autoCommit, const std::function< void(void)> &onAutoCommit, const std::function< void(const std::string &, unsigned int)> &onError)
Definition
MariaDBAutoCommitCommand.cpp:29
database::mariadb::commands::async::MariaDBAutoCommitCommand::commandError
void commandError(const std::string &errorString, unsigned int errorNumber) override
Definition
MariaDBAutoCommitCommand.cpp:51
database::mariadb::commands::async::MariaDBAutoCommitCommand::commandCompleted
bool commandCompleted() override
Definition
MariaDBAutoCommitCommand.cpp:45
database::mariadb::commands::async::MariaDBAutoCommitCommand::commandContinue
int commandContinue(int status) override
Definition
MariaDBAutoCommitCommand.cpp:41
database::mariadb::commands
Definition
MariaDBAutoCommitCommand.cpp:27
database
Definition
MariaDBClient.h:39
database
mariadb
commands
async
MariaDBAutoCommitCommand.cpp
Generated on Mon Feb 10 2025 20:20:55 for SNode.C by
1.11.0