Fix the INSERT query for types that don’t have any Id column

This commit is contained in:
louiz’
2018-03-12 00:17:03 +01:00
parent bb596582bd
commit 9e4a3e2b05
+9 -1
View File
@@ -50,7 +50,8 @@ struct Row
} }
private: 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); InsertQuery query(this->table_name, this->columns);
// Ugly workaround for non portable stuff // Ugly workaround for non portable stuff
@@ -58,6 +59,13 @@ struct Row
query.execute(db, this->columns); 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) void update(DatabaseEngine& db)
{ {
UpdateQuery query(this->table_name, this->columns); UpdateQuery query(this->table_name, this->columns);