// file : libbrep/common-traits.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2018 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #ifndef LIBBREP_COMMON_TRAITS_HXX #define LIBBREP_COMMON_TRAITS_HXX #include #include // size_t #include // move() #include #include namespace odb { namespace pgsql { template <> class value_traits: value_traits { public: using value_type = bpkg::package_name; using query_type = bpkg::package_name; using image_type = details::buffer; using base_type = value_traits; static void set_value (value_type& v, const details::buffer& b, std::size_t n, bool is_null) { std::string s; base_type::set_value (s, b, n, is_null); v = !s.empty () ? value_type (std::move (s)) : value_type (); } static void set_image (details::buffer& b, std::size_t& n, bool& is_null, const value_type& v) { base_type::set_image (b, n, is_null, v.string ()); } }; template <> struct type_traits { static const database_type_id db_type_id = id_string; struct conversion { static const char* to () {return "(?)::CITEXT";} }; }; } } #endif // LIBBREP_COMMON_TRAITS_HXX