mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
add an unsigned integer field in tests/Ppgen.cpp
This commit is contained in:
parent
49d46edab2
commit
e5b9e0a4f3
@ -52,6 +52,7 @@ SQLPP_DECLARE_TABLE(
|
|||||||
(id , int , SQLPP_PRIMARY_KEY)
|
(id , int , SQLPP_PRIMARY_KEY)
|
||||||
(name , varchar(255), SQLPP_NOT_NULL )
|
(name , varchar(255), SQLPP_NOT_NULL )
|
||||||
(feature, int , SQLPP_NOT_NULL )
|
(feature, int , SQLPP_NOT_NULL )
|
||||||
|
(age , int_unsigned, SQLPP_NOT_NULL )
|
||||||
(level , real , SQLPP_NOT_NULL )
|
(level , real , SQLPP_NOT_NULL )
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -77,20 +78,28 @@ int Ppgen(int, char* [])
|
|||||||
|
|
||||||
db(insert_into(f).default_values());
|
db(insert_into(f).default_values());
|
||||||
|
|
||||||
auto i = insert_into(p).columns(p.name, p.feature, p.level);
|
auto i = insert_into(p).columns(p.name, p.feature, p.age, p.level);
|
||||||
i.values.add(p.name = "Roland", p.feature = 1, p.level = 3.14);
|
i.values.add(p.name = "Roland"
|
||||||
i.values.add(p.name = "Zaphod", p.feature = sqlpp::default_value, p.level = 3.14*2);
|
, p.feature = 1
|
||||||
|
, p.age = static_cast<unsigned int>(32)
|
||||||
|
, p.level = 3.14);
|
||||||
|
i.values.add(p.name = "Zaphod"
|
||||||
|
, p.feature = sqlpp::default_value
|
||||||
|
, p.age = static_cast<unsigned int>(16)
|
||||||
|
, p.level = 3.14*2);
|
||||||
db(i);
|
db(i);
|
||||||
|
|
||||||
auto pi = db.prepare(
|
auto pi = db.prepare(
|
||||||
insert_into(p).set(
|
insert_into(p).set(
|
||||||
p.name = parameter(f.name)
|
p.name = parameter(f.name)
|
||||||
,p.feature = parameter(p.feature)
|
,p.feature = parameter(p.feature)
|
||||||
|
,p.age = parameter(p.age)
|
||||||
,p.level = parameter(p.level)
|
,p.level = parameter(p.level)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
pi.params.name = "likes java";
|
pi.params.name = "likes java";
|
||||||
pi.params.feature = 2;
|
pi.params.feature = 2;
|
||||||
|
pi.params.age = 21;
|
||||||
pi.params.level = 3.14;
|
pi.params.level = 3.14;
|
||||||
|
|
||||||
db(pi);
|
db(pi);
|
||||||
|
Loading…
Reference in New Issue
Block a user