From ab1487672afb5180bd17c9d26b35196bd06f6cda Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 28 Jul 2011 09:45:36 +0200 Subject: Add value_traits specializations for std::vector This allows using it as a buffer for BLOB mapping. --- pgsql/types/traits.hxx | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'pgsql/types/traits.hxx') diff --git a/pgsql/types/traits.hxx b/pgsql/types/traits.hxx index b3aec70..9852727 100644 --- a/pgsql/types/traits.hxx +++ b/pgsql/types/traits.hxx @@ -12,49 +12,12 @@ #include #include -#include "test.hxx" // varbit, buffer, ubuffer, string_ptr +#include "test.hxx" // varbit, ubuffer, string_ptr namespace odb { namespace pgsql { - template <> - class value_traits - { - public: - typedef buffer value_type; - typedef buffer query_type; - typedef details::buffer image_type; - - static void - set_value (buffer& v, - const details::buffer& b, - std::size_t n, - bool is_null) - { - if (!is_null) - v.assign (b.data (), n); - else - v.assign (0, 0); - } - - static void - set_image (details::buffer& b, - std::size_t& n, - bool& is_null, - const buffer& v) - { - is_null = false; - n = v.size (); - - if (n > b.capacity ()) - b.capacity (n); - - if (n != 0) - std::memcpy (b.data (), v.data (), n); - } - }; - // The first 4 bytes of the image is a signed int specifying the // number of significant bits contained by the BIT. The following // bytes contain the bit data. -- cgit v1.1