From 9e4a3e2b054ee4604b6a42c73895216c68fa96e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Mon, 12 Mar 2018 00:17:03 +0100 Subject: =?UTF-8?q?Fix=20the=20INSERT=20query=20for=20types=20that=20don?= =?UTF-8?q?=E2=80=99t=20have=20any=20Id=20column?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/database/row.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 + void insert(DatabaseEngine& db, typename std::enable_if && 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 + void insert(DatabaseEngine& db, typename std::enable_if && 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); -- cgit v1.2.3