aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/traits.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/sqlite/traits.hxx')
-rw-r--r--odb/sqlite/traits.hxx37
1 files changed, 36 insertions, 1 deletions
diff --git a/odb/sqlite/traits.hxx b/odb/sqlite/traits.hxx
index 5d88365..b53d3ab 100644
--- a/odb/sqlite/traits.hxx
+++ b/odb/sqlite/traits.hxx
@@ -268,7 +268,8 @@ namespace odb
// std::vector<char> (buffer) specialization.
//
template <>
- struct LIBODB_SQLITE_EXPORT default_value_traits<std::vector<char>, id_blob>
+ struct LIBODB_SQLITE_EXPORT default_value_traits<
+ std::vector<char>, id_blob>
{
public:
typedef std::vector<char> value_type;
@@ -294,6 +295,40 @@ namespace odb
const value_type&);
};
+ // std::vector<unsigned char> (buffer) specialization.
+ //
+ template <>
+ struct LIBODB_SQLITE_EXPORT default_value_traits<
+ std::vector<unsigned char>, id_blob>
+ {
+ public:
+ typedef std::vector<unsigned char> value_type;
+ typedef std::vector<unsigned char> query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (value_type& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ if (!is_null)
+ {
+ const unsigned char* d (
+ reinterpret_cast<const unsigned char*> (b.data ()));
+ v.assign (d, d + n);
+ }
+ else
+ v.clear ();
+ }
+
+ static void
+ set_image (details::buffer&,
+ std::size_t& n,
+ bool& is_null,
+ const value_type&);
+ };
+
//
// type_traits
//