diff options
-rw-r--r-- | odb/traits.hxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/odb/traits.hxx b/odb/traits.hxx index 8aee00c..aa98ae1 100644 --- a/odb/traits.hxx +++ b/odb/traits.hxx @@ -7,6 +7,7 @@ #define ODB_TRAITS_HXX #include <odb/forward.hxx> +#include <odb/buffer.hxx> #include <odb/shared-ptr.hxx> #include <odb/pointer-traits.hxx> @@ -88,6 +89,30 @@ namespace odb pointer_traits<typename access::object_traits<T>::pointer_type> pointer_ops; }; + + template <typename V> + struct value_traits + { + typedef V value_type; + + template <typename I> + static void + set_value (value_type& v, I i, bool is_null) + { + if (!is_null) + v = value_type (i); + else + v = value_type (); + } + + template <typename I> + static void + set_image (I& i, bool& is_null, value_type v) + { + is_null = false; + i = I (v); + } + }; } #endif // ODB_TRAITS_HXX |