diff options
Diffstat (limited to 'common/view/test.hxx')
-rw-r--r-- | common/view/test.hxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/common/view/test.hxx b/common/view/test.hxx index 37486aa..2497097 100644 --- a/common/view/test.hxx +++ b/common/view/test.hxx @@ -172,6 +172,21 @@ struct view1c unsigned short age; }; +// Assembled SELECT and FROM-lists. +// +#pragma db view table("common_view_person") +struct view1d +{ + #pragma db column("first") + std::string first; + + #pragma db column("last") + std::string last; + + #pragma db column("age") + unsigned short age; +}; + // // Count view plus associated object. // @@ -330,6 +345,23 @@ struct view6b std::string employer; }; +// The same using tables. +// +#pragma db view table("common_view_person" = "p") \ + table("common_view_employer_employees" = "ee": "ee.value = p.id") \ + table("common_view_employer" = "e": "ee.object_id = e.name") +struct view6c +{ + #pragma db column("p.first") + std::string first_name; + + #pragma db column("p"."last") + std::string last_name; + + #pragma db column("e.name") + std::string employer; +}; + // // JOIN via a custom condition. // |