aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/traits-calls.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-09-04 13:40:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-09-04 13:40:31 +0200
commit485ae35a88fe2500574797d7342cfa7585e9e191 (patch)
tree977ba286e2d5d2659ab691d8173f556bf60a3594 /odb/pgsql/traits-calls.hxx
parent259a683ec2a4f777f605bdd527b9882c3a965ee3 (diff)
View versioning support
Diffstat (limited to 'odb/pgsql/traits-calls.hxx')
-rw-r--r--odb/pgsql/traits-calls.hxx81
1 files changed, 76 insertions, 5 deletions
diff --git a/odb/pgsql/traits-calls.hxx b/odb/pgsql/traits-calls.hxx
index ee91e62..5313596 100644
--- a/odb/pgsql/traits-calls.hxx
+++ b/odb/pgsql/traits-calls.hxx
@@ -20,18 +20,22 @@ namespace odb
{
namespace pgsql
{
+ //
+ // object_traits_calls
+ //
+
template <typename T,
bool versioned = object_traits_impl<T, id_pgsql>::versioned>
- struct traits_calls;
+ struct object_traits_calls;
template <typename T>
- struct traits_calls<T, false>
+ struct object_traits_calls<T, false>
{
typedef object_traits_impl<T, id_pgsql> traits;
typedef typename traits::image_type image_type;
typedef pgsql::bind bind_type;
- traits_calls (const schema_version_migration*) {}
+ object_traits_calls (const schema_version_migration*) {}
const schema_version_migration*
version () const {return 0;}
@@ -80,13 +84,13 @@ namespace odb
};
template <typename T>
- struct traits_calls<T, true>
+ struct object_traits_calls<T, true>
{
typedef object_traits_impl<T, id_pgsql> traits;
typedef typename traits::image_type image_type;
typedef pgsql::bind bind_type;
- traits_calls (const schema_version_migration* svm): svm_ (*svm) {}
+ object_traits_calls (const schema_version_migration* svm): svm_ (*svm) {}
const schema_version_migration*
version () const {return &svm_;}
@@ -136,6 +140,73 @@ namespace odb
private:
const schema_version_migration& svm_;
};
+
+ //
+ // view_traits_calls
+ //
+
+ template <typename T,
+ bool versioned = view_traits_impl<T, id_pgsql>::versioned>
+ struct view_traits_calls;
+
+ template <typename T>
+ struct view_traits_calls<T, false>
+ {
+ typedef view_traits_impl<T, id_pgsql> traits;
+ typedef typename traits::image_type image_type;
+ typedef pgsql::bind bind_type;
+
+ view_traits_calls (const schema_version_migration*) {}
+
+ static bool
+ grow (image_type& i, bool* t)
+ {
+ return traits::grow (i, t);
+ }
+
+ static void
+ bind (bind_type* b, image_type& i)
+ {
+ traits::bind (b, i);
+ }
+
+ static void
+ init (T& o, const image_type& i, odb::database* db)
+ {
+ traits::init (o, i, db);
+ }
+ };
+
+ template <typename T>
+ struct view_traits_calls<T, true>
+ {
+ typedef view_traits_impl<T, id_pgsql> traits;
+ typedef typename traits::image_type image_type;
+ typedef pgsql::bind bind_type;
+
+ view_traits_calls (const schema_version_migration* svm): svm_ (*svm) {}
+
+ bool
+ grow (image_type& i, bool* t) const
+ {
+ return traits::grow (i, t, svm_);
+ }
+
+ void
+ bind (bind_type* b, image_type& i) const
+ {
+ traits::bind (b, i, svm_);
+ }
+
+ void
+ init (T& o, const image_type& i, odb::database* db) const
+ {
+ traits::init (o, i, db, svm_);
+ }
+
+ private:
+ const schema_version_migration& svm_;
+ };
}
}