From 928282a9eff985139a056d5b3ee8c7775bcbc84c Mon Sep 17 00:00:00 2001 From: niXman Date: Thu, 12 Apr 2018 13:55:16 +0300 Subject: [PATCH 1/2] real type support added for ppgen(part 1) --- include/sqlpp11/ppgen/colops/floating_point.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/sqlpp11/ppgen/colops/floating_point.h b/include/sqlpp11/ppgen/colops/floating_point.h index bd8881f3..2980815e 100644 --- a/include/sqlpp11/ppgen/colops/floating_point.h +++ b/include/sqlpp11/ppgen/colops/floating_point.h @@ -34,6 +34,11 @@ #define SQLPP_DECLARE_COLUMN_GEN_TRAITS_PROC_float(...) \ ::sqlpp::floating_point +#define SQLPP_DECLARE_COLUMN_GET_TRAITS_LAZY_real \ + PROC_real +#define SQLPP_DECLARE_COLUMN_GEN_TRAITS_PROC_real(...) \ + ::sqlpp::floating_point + #define SQLPP_DECLARE_COLUMN_GET_TRAITS_LAZY_double \ PROC_double #define SQLPP_DECLARE_COLUMN_GEN_TRAITS_PROC_double(...) \ From 7d8fdaa9df64123e7bfbac83b4c173a42f1d5719 Mon Sep 17 00:00:00 2001 From: niXman Date: Thu, 12 Apr 2018 13:56:20 +0300 Subject: [PATCH 2/2] real type support added for ppgen(part 2) --- tests/Ppgen.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/Ppgen.cpp b/tests/Ppgen.cpp index 9093e473..296187e1 100644 --- a/tests/Ppgen.cpp +++ b/tests/Ppgen.cpp @@ -52,6 +52,7 @@ SQLPP_DECLARE_TABLE( (id , int , SQLPP_PRIMARY_KEY) (name , varchar(255), SQLPP_NOT_NULL ) (feature, int , SQLPP_NOT_NULL ) + (level , real , SQLPP_NOT_NULL ) ) SQLPP_DECLARE_TABLE( @@ -76,14 +77,21 @@ int Ppgen(int, char* []) db(insert_into(f).default_values()); - auto i = insert_into(p).columns(p.name, p.feature); - i.values.add(p.name = "Roland", p.feature = 1); - i.values.add(p.name = "Zaphod", p.feature = sqlpp::default_value); + auto i = insert_into(p).columns(p.name, p.feature, p.level); + i.values.add(p.name = "Roland", p.feature = 1, p.level = 3.14); + i.values.add(p.name = "Zaphod", p.feature = sqlpp::default_value, p.level = 3.14*2); db(i); - auto pi = db.prepare(insert_into(p).set(p.name = parameter(f.name), p.feature = parameter(p.feature))); + auto pi = db.prepare( + insert_into(p).set( + p.name = parameter(f.name) + ,p.feature = parameter(p.feature) + ,p.level = parameter(p.level) + ) + ); pi.params.name = "likes java"; - pi.params.feature = true; + pi.params.feature = 2; + pi.params.level = 3.14; db(pi); return 0;