From c1992535dea46aa98dbbabb98910ce102fbfc058 Mon Sep 17 00:00:00 2001 From: Roland Bock Date: Fri, 3 Nov 2023 07:23:34 +0100 Subject: [PATCH] Demonstrate insert with select (#539) --- tests/core/usage/Insert.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/core/usage/Insert.cpp b/tests/core/usage/Insert.cpp index ba84f9ed..f5fb3cc3 100644 --- a/tests/core/usage/Insert.cpp +++ b/tests/core/usage/Insert.cpp @@ -32,6 +32,7 @@ #endif #include #include +#include int Insert(int, char*[]) { @@ -39,7 +40,7 @@ int Insert(int, char*[]) MockDb::_serializer_context_t printer = {}; const auto t = test::TabBar{}; const auto tabDateTime = test::TabDateTime{}; - // test::TabFoo f; + const auto u = test::TabFoo{}; { using T = decltype(insert_into(t)); @@ -98,6 +99,8 @@ int Insert(int, char*[]) db(insert_into(t).set(t.gamma = true, t.delta = 0)); db(insert_into(t).set(values())); + db(insert_into(t).set(t.gamma = true, t.delta = 0, t.beta = select(u.delta).from(u).unconditionally())); + auto prepared_insert = db.prepare(insert_into(t).set(t.gamma = parameter(t.gamma), t.delta = parameter(t.delta))); prepared_insert.params.gamma = true; prepared_insert.params.delta = sqlpp::null;