mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Merge pull request #228 from niXman/develop
real type support added for ppgen
This commit is contained in:
commit
d2dc3124fb
@ -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(...) \
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user