From 60d4d13a85130ccdc3b232e420bc3c18683846b9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 3 Nov 2011 10:11:24 +0200 Subject: Add support for mapping char[N] and unsigned char[N] types to BLOB New test: common/blob. --- odb/oracle/traits.txx | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 odb/oracle/traits.txx (limited to 'odb/oracle/traits.txx') diff --git a/odb/oracle/traits.txx b/odb/oracle/traits.txx new file mode 100644 index 0000000..86eab47 --- /dev/null +++ b/odb/oracle/traits.txx @@ -0,0 +1,70 @@ +// file : odb/oracle/traits.txx +// author : Constantin Michael +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : ODB NCUEL; see accompanying LICENSE file + +namespace odb +{ + namespace oracle + { + // + // default_value_traits + // + + template + bool default_value_traits:: + result_callback (void* c, ub4* position, void* b, ub4 s, chunk_position) + { + ub4 n (*position + s < N ? s : N - *position); + std::memcpy (static_cast (c) + *position, b, n); + *position += n; + return true; + } + + template + bool default_value_traits:: + param_callback (const void* c, + ub4*, + const void** b, + ub4* s, + chunk_position* p, + void*, + ub4) + { + *p = one_chunk; + *s = static_cast (N); + *b = c; + return true; + } + + // + // default_value_traits + // + + template + bool default_value_traits:: + result_callback (void* c, ub4* position, void* b, ub4 s, chunk_position) + { + ub4 n (*position + s < N ? s : N - *position); + std::memcpy (static_cast (c) + *position, b, n); + *position += n; + return true; + } + + template + bool default_value_traits:: + param_callback (const void* c, + ub4*, + const void** b, + ub4* s, + chunk_position* p, + void*, + ub4) + { + *p = one_chunk; + *s = static_cast (N); + *b = c; + return true; + } + } +} -- cgit v1.1