diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-02-01 15:47:37 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-02-01 15:47:37 +0300 |
commit | 62e234c114d2b6ead93a1d39593c66b648c3d0a6 (patch) | |
tree | ce6740b4508eb29400490b20efc8e100e38a7b7f /libodb-oracle/odb/oracle/traits.txx | |
parent | 9072842a023c4b65ecb141292c4b63417fee1b98 (diff) |
Turn libodb-oracle repository into package for muti-package repositorylibodb-oracle
Diffstat (limited to 'libodb-oracle/odb/oracle/traits.txx')
-rw-r--r-- | libodb-oracle/odb/oracle/traits.txx | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/libodb-oracle/odb/oracle/traits.txx b/libodb-oracle/odb/oracle/traits.txx new file mode 100644 index 0000000..22d8f9e --- /dev/null +++ b/libodb-oracle/odb/oracle/traits.txx @@ -0,0 +1,130 @@ +// file : odb/oracle/traits.txx +// license : ODB NCUEL; see accompanying LICENSE file + +namespace odb +{ + namespace oracle + { + // + // default_value_traits<char[N], id_blob> + // + + template <std::size_t N> + bool default_value_traits<char[N], id_blob>:: + result_callback (void* c, ub4* position, void* b, ub4 s, chunk_position) + { + ub4 n (*position + s < N ? s : N - *position); + std::memcpy (static_cast<char*> (c) + *position, b, n); + *position += n; + return true; + } + + template <std::size_t N> + bool default_value_traits<char[N], id_blob>:: + param_callback (const void* c, + ub4*, + const void** b, + ub4* s, + chunk_position* p, + void*, + ub4) + { + *p = chunk_one; + *s = static_cast<ub4> (N); + *b = c; + return true; + } + + // + // default_value_traits<unsigned char[N], id_blob> + // + + template <std::size_t N> + bool default_value_traits<unsigned char[N], id_blob>:: + result_callback (void* c, ub4* position, void* b, ub4 s, chunk_position) + { + ub4 n (*position + s < N ? s : N - *position); + std::memcpy (static_cast<unsigned char*> (c) + *position, b, n); + *position += n; + return true; + } + + template <std::size_t N> + bool default_value_traits<unsigned char[N], id_blob>:: + param_callback (const void* c, + ub4*, + const void** b, + ub4* s, + chunk_position* p, + void*, + ub4) + { + *p = chunk_one; + *s = static_cast<ub4> (N); + *b = c; + return true; + } + +#ifdef ODB_CXX11 + // + // default_value_traits<std::array<char, N>, id_blob> + // + + template <std::size_t N> + bool default_value_traits<std::array<char, N>, id_blob>:: + result_callback (void* c, ub4* position, void* b, ub4 s, chunk_position) + { + ub4 n (*position + s < N ? s : N - *position); + std::memcpy (static_cast<char*> (c) + *position, b, n); + *position += n; + return true; + } + + template <std::size_t N> + bool default_value_traits<std::array<char, N>, id_blob>:: + param_callback (const void* c, + ub4*, + const void** b, + ub4* s, + chunk_position* p, + void*, + ub4) + { + *p = chunk_one; + *s = static_cast<ub4> (N); + *b = c; + return true; + } + + // + // default_value_traits<std::array<unsigned char, N>, id_blob> + // + + template <std::size_t N> + bool default_value_traits<std::array<unsigned char, N>, id_blob>:: + result_callback (void* c, ub4* position, void* b, ub4 s, chunk_position) + { + ub4 n (*position + s < N ? s : N - *position); + std::memcpy (static_cast<unsigned char*> (c) + *position, b, n); + *position += n; + return true; + } + + template <std::size_t N> + bool default_value_traits<std::array<unsigned char, N>, id_blob>:: + param_callback (const void* c, + ub4*, + const void** b, + ub4* s, + chunk_position* p, + void*, + ub4) + { + *p = chunk_one; + *s = static_cast<ub4> (N); + *b = c; + return true; + } +#endif + } +} |