From 0acb35c3ff7ce7e98fd6f3a92552558ec39f7c3d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 3 Nov 2011 08:16:50 +0200 Subject: Add support for mapping std::vector to BLOB types --- odb/pgsql/traits.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'odb/pgsql/traits.cxx') diff --git a/odb/pgsql/traits.cxx b/odb/pgsql/traits.cxx index a2c2f2f..9e31c9f 100644 --- a/odb/pgsql/traits.cxx +++ b/odb/pgsql/traits.cxx @@ -76,5 +76,27 @@ namespace odb if (n != 0) memcpy (b.data (), &v.front (), n); } + + // + // default_value_traits, id_bytea> + // + + void default_value_traits, id_bytea>:: + set_image (details::buffer& b, + size_t& n, + bool& is_null, + const value_type& v) + { + is_null = false; + n = v.size (); + + if (n > b.capacity ()) + b.capacity (n); + + // std::vector::data() may not be available in older compilers. + // + if (n != 0) + memcpy (b.data (), &v.front (), n); + } } } -- cgit v1.1