File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 29
29
#include < sqlpp11/alias_provider.h>
30
30
#include < iostream>
31
31
32
+ namespace greek
33
+ {
34
+ SQLPP_ALIAS_PROVIDER (alpha)
35
+ SQLPP_ALIAS_PROVIDER (beta)
36
+ }
37
+
32
38
int Union (int , char * [])
33
39
{
34
40
MockDb db;
@@ -40,6 +46,15 @@ int Union(int, char* [])
40
46
db (select (t.alpha ).from (t).unconditionally ().union_distinct (select (f.epsilon .as (t.alpha )).from (f).unconditionally ()));
41
47
db (select (t.alpha ).from (t).unconditionally ().union_all (select (f.epsilon .as (t.alpha )).from (f).unconditionally ()));
42
48
49
+ // t.alpha can be null, a given value cannot
50
+ db (select (t.alpha ).from (t).unconditionally ().union_all (select (sqlpp::value (1 ).as (t.alpha ))));
51
+ db (select (t.alpha ).from (t).unconditionally ().union_all (select (sqlpp::value (1 ).as (greek::alpha))));
52
+
53
+ // t.beta can be null, f.delta cannot
54
+ static_assert (sqlpp::can_be_null_t <decltype (t.beta )>::value, " " );
55
+ static_assert (!sqlpp::can_be_null_t <decltype (f.delta )>::value, " " );
56
+ db (select (t.beta ).from (t).unconditionally ().union_all (select (f.delta .as (greek::beta)).from (f).unconditionally ()));
57
+
43
58
auto u = select (t.alpha )
44
59
.from (t)
45
60
.unconditionally ()
You can’t perform that action at this time.
0 commit comments