aboutsummaryrefslogtreecommitdiff
path: root/hello/person.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-10-02 16:21:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-10-02 16:21:47 +0200
commit5d60da7c563025101a7a94012bb0facf88add351 (patch)
tree66eb7e3f2501fa4c761c08dcae351d0bc9625806 /hello/person.hxx
parentc428f1b17bbeee47cb16ecca6992f4bf19e382dd (diff)
Add simple view to hello example
Diffstat (limited to 'hello/person.hxx')
-rw-r--r--hello/person.hxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/hello/person.hxx b/hello/person.hxx
index 69b1878..f480723 100644
--- a/hello/person.hxx
+++ b/hello/person.hxx
@@ -6,6 +6,7 @@
#define PERSON_HXX
#include <string>
+#include <cstddef> // std::size_t
#include <odb/core.hxx>
@@ -57,4 +58,17 @@ private:
unsigned short age_;
};
+#pragma db view object(person)
+struct person_stat
+{
+ #pragma db column("count(" + person::id_ + ")")
+ std::size_t count;
+
+ #pragma db column("min(" + person::age_ + ")")
+ unsigned short min_age;
+
+ #pragma db column("max(" + person::age_ + ")")
+ unsigned short max_age;
+};
+
#endif // PERSON_HXX