diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-02-04 17:23:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-02-04 17:23:54 +0200 |
commit | 0ac8f52ddfae8537651c65b8ab8b32db47756e74 (patch) | |
tree | be6239b8e7f528c7c25a05f83af2ec806043fbd6 /view/employee.hxx | |
parent | 613da395f986ff748448d5afc06319f84a734397 (diff) |
Implement object loading views
See section 10.2 in the manual for details.
Diffstat (limited to 'view/employee.hxx')
-rw-r--r-- | view/employee.hxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/view/employee.hxx b/view/employee.hxx index 39d494f..87f0bce 100644 --- a/view/employee.hxx +++ b/view/employee.hxx @@ -239,6 +239,21 @@ struct employee_country std::string nat_country_name; }; +// An example of an object loading view. It is a different version of +// the above view that loads the complete objects instead of a subset +// of their data members. +// +#pragma db view object(employee) \ + object(country = res: employee::residence_) \ + object(country = nat: employee::nationality_) +struct employee_country_objects +{ + shared_ptr<employee> e; + shared_ptr<country> res; + shared_ptr<country> nat; +}; + + // An example of a native view that provides a complete query and is based // on an ad-hoc table. This view allows us to load the employee vacation // information from the legacy employee_extra table. |