diff options
| author | ilotterytea <iltsu@alright.party> | 2024-04-30 20:56:54 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-04-30 20:56:54 +0500 |
| commit | 184fcd5cb5bacd11271028c1031a7bfef4db48a2 (patch) | |
| tree | cab57979313878fab91b845511b60f43a092246b /src | |
| parent | d0671a30c2b5ec41b131d229716045381332697d (diff) | |
upd: replaced work to connection
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands/request.hpp | 2 | ||||
| -rw-r--r-- | src/commands/request_util.cpp | 2 | ||||
| -rw-r--r-- | src/commands/request_util.hpp | 2 | ||||
| -rw-r--r-- | src/handlers.cpp | 4 | ||||
| -rw-r--r-- | src/handlers.hpp | 2 | ||||
| -rw-r--r-- | src/main.cpp | 4 |
6 files changed, 7 insertions, 9 deletions
diff --git a/src/commands/request.hpp b/src/commands/request.hpp index ee7bd11..efa0655 100644 --- a/src/commands/request.hpp +++ b/src/commands/request.hpp @@ -12,6 +12,6 @@ namespace bot::command { std::optional<std::string> subcommand_id; std::optional<std::string> message; const irc::Message<irc::MessageType::Privmsg> &irc_message; - const pqxx::work &work; + pqxx::connection &conn; }; } diff --git a/src/commands/request_util.cpp b/src/commands/request_util.cpp index 1262a3d..08e958a 100644 --- a/src/commands/request_util.cpp +++ b/src/commands/request_util.cpp @@ -12,7 +12,7 @@ namespace bot::command { std::optional<Request> generate_request( const command::CommandLoader &command_loader, const irc::Message<irc::MessageType::Privmsg> &irc_message, - const pqxx::work &work) { + pqxx::connection &conn) { std::vector<std::string> parts = utils::string::split_text(irc_message.message, ' '); diff --git a/src/commands/request_util.hpp b/src/commands/request_util.hpp index 3d9831d..dea6e12 100644 --- a/src/commands/request_util.hpp +++ b/src/commands/request_util.hpp @@ -9,5 +9,5 @@ namespace bot::command { std::optional<Request> generate_request( const command::CommandLoader &command_loader, const irc::Message<irc::MessageType::Privmsg> &irc_message, - const pqxx::work &work); + pqxx::connection &conn); } diff --git a/src/handlers.cpp b/src/handlers.cpp index cd6860a..c3f12d3 100644 --- a/src/handlers.cpp +++ b/src/handlers.cpp @@ -16,9 +16,9 @@ namespace bot::handlers { const InstanceBundle &bundle, const command::CommandLoader &command_loader, const irc::Message<irc::MessageType::Privmsg> &message, - const pqxx::work &work) { + pqxx::connection &conn) { std::optional<command::Request> request = - command::generate_request(command_loader, message, work); + command::generate_request(command_loader, message, conn); if (request.has_value()) { auto o_response = command_loader.run(bundle, request.value()); diff --git a/src/handlers.hpp b/src/handlers.hpp index 33b57b2..a143f76 100644 --- a/src/handlers.hpp +++ b/src/handlers.hpp @@ -10,5 +10,5 @@ namespace bot::handlers { const InstanceBundle &bundle, const command::CommandLoader &command_loader, const irc::Message<irc::MessageType::Privmsg> &message, - const pqxx::work &work); + pqxx::connection &conn); } diff --git a/src/main.cpp b/src/main.cpp index 67cf3a5..f9be192 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -61,12 +61,10 @@ int main(int argc, char *argv[]) { bot::InstanceBundle bundle{client, localization}; pqxx::connection conn(GET_DATABASE_CONNECTION_URL(cfg)); - pqxx::work work(conn); bot::handlers::handle_private_message(bundle, command_loader, message, - work); + conn); - work.commit(); conn.close(); }); |
