summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-03-12 00:17:03 +0100
committerlouiz’ <louiz@louiz.org>2018-03-12 00:17:03 +0100
commit9e4a3e2b054ee4604b6a42c73895216c68fa96e7 (patch)
treea1fb2969a11ac56b1be17c48c1992a12ccb92510
parentbb596582bd2d8b9aab3fe08e76a7d24d82bf614a (diff)
downloadbiboumi-9e4a3e2b054ee4604b6a42c73895216c68fa96e7.tar.gz
biboumi-9e4a3e2b054ee4604b6a42c73895216c68fa96e7.tar.bz2
biboumi-9e4a3e2b054ee4604b6a42c73895216c68fa96e7.tar.xz
biboumi-9e4a3e2b054ee4604b6a42c73895216c68fa96e7.zip
Fix the INSERT query for types that don’t have any Id column
-rw-r--r--src/database/row.hpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/database/row.hpp b/src/database/row.hpp
index 4dc98be..3703ff7 100644
--- a/src/database/row.hpp
+++ b/src/database/row.hpp
@@ -50,7 +50,8 @@ struct Row
}
private:
- void insert(DatabaseEngine& db)
+ template <bool Coucou=true>
+ void insert(DatabaseEngine& db, typename std::enable_if<is_one_of<Id, T...> && Coucou>::type* = nullptr)
{
InsertQuery query(this->table_name, this->columns);
// Ugly workaround for non portable stuff
@@ -58,6 +59,13 @@ struct Row
query.execute(db, this->columns);
}
+ template <bool Coucou=true>
+ void insert(DatabaseEngine& db, typename std::enable_if<!is_one_of<Id, T...> && Coucou>::type* = nullptr)
+ {
+ InsertQuery query(this->table_name, this->columns);
+ query.execute(db, this->columns);
+ }
+
void update(DatabaseEngine& db)
{
UpdateQuery query(this->table_name, this->columns);