diff options
author | louiz’ <louiz@louiz.org> | 2018-03-18 02:50:33 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2018-03-18 02:54:34 +0100 |
commit | 5af0a8040c33d07dacf78343eb9ed0a03437a65a (patch) | |
tree | 0473c864e9e32c947a2c4879997a00c5838b040e /src/database/database.hpp | |
parent | c8e96fc31bc9938e9fb59af77676305b14a289a2 (diff) | |
download | biboumi-5af0a8040c33d07dacf78343eb9ed0a03437a65a.tar.gz biboumi-5af0a8040c33d07dacf78343eb9ed0a03437a65a.tar.bz2 biboumi-5af0a8040c33d07dacf78343eb9ed0a03437a65a.tar.xz biboumi-5af0a8040c33d07dacf78343eb9ed0a03437a65a.zip |
Use a transaction around the DELETE + INSERT of the after_connection_commands
Otherwise we can imagine that two clients changing this value at the same
time would mix things up.
ref #3275
Diffstat (limited to 'src/database/database.hpp')
-rw-r--r-- | src/database/database.hpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/database/database.hpp b/src/database/database.hpp index 0e88be8..5dde447 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -203,11 +203,20 @@ class Database static auto raw_exec(const std::string& query) { - Database::db->raw_exec(query); + return Database::db->raw_exec(query); } private: static std::string gen_uuid(); static std::map<CacheKey, EncodingIn::real_type> encoding_in_cache; }; + +class Transaction +{ +public: + Transaction(); + ~Transaction(); + bool success{false}; +}; + #endif /* USE_DATABASE */ |