diff options
author | louiz’ <louiz@louiz.org> | 2018-04-29 01:40:46 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2018-04-29 01:40:46 +0200 |
commit | 7592d966e684410f603942e34413375c8d98ac9e (patch) | |
tree | 7b3af3008c6a6532edbf4f4fe3534778886e669e /src/database/row.hpp | |
parent | efa63ee5cb4be3aebc1489dc9db936eea26660d4 (diff) | |
download | biboumi-7592d966e684410f603942e34413375c8d98ac9e.tar.gz biboumi-7592d966e684410f603942e34413375c8d98ac9e.tar.bz2 biboumi-7592d966e684410f603942e34413375c8d98ac9e.tar.xz biboumi-7592d966e684410f603942e34413375c8d98ac9e.zip |
Missing fields in a data-form response are now interpreted as an empty value
Diffstat (limited to 'src/database/row.hpp')
-rw-r--r-- | src/database/row.hpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/database/row.hpp b/src/database/row.hpp index 27caf43..1253f93 100644 --- a/src/database/row.hpp +++ b/src/database/row.hpp @@ -1,7 +1,5 @@ #pragma once -#include <utils/is_one_of.hpp> - #include <type_traits> template <typename... T> @@ -25,7 +23,24 @@ struct Row return col.value; } -public: + void clear() + { + this->clear_col<0>(); + } + std::tuple<T...> columns; std::string table_name; + +private: + template <std::size_t N> + typename std::enable_if<N < sizeof...(T), void>::type + clear_col() + { + std::get<N>(this->columns).clear(); + this->clear_col<N+1>(); + } + template <std::size_t N> + typename std::enable_if<N == sizeof...(T), void>::type + clear_col() + { } }; |