diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-10-20 10:13:51 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-10-20 10:13:51 +0200 |
commit | a64b2d953da436bdca5cf35329d10fd95e1ae860 (patch) | |
tree | 41895467ab26cee1f2d8a685367b9329dd6d31ed /odb/oracle/traits.hxx | |
parent | 3f98883f49d8f0823e6d2d0fca1c5ac87a320f89 (diff) |
Use SQLT_NUM instead of SQLT_VNU OCI type due to inconsistent buffer lengths
The size returned by OCI into the bound rlen parameter of a SQLT_VNU buffer
does not include the additional length byte. This causes problems with images
that are shared across multiple statements in ODB, such as the object_id
image of containers.
Diffstat (limited to 'odb/oracle/traits.hxx')
-rw-r--r-- | odb/oracle/traits.hxx | 72 |
1 files changed, 29 insertions, 43 deletions
diff --git a/odb/oracle/traits.hxx b/odb/oracle/traits.hxx index 6bcc1ac..0458aef 100644 --- a/odb/oracle/traits.hxx +++ b/odb/oracle/traits.hxx @@ -8,9 +8,6 @@ #include <odb/pre.hxx> -// @@ -#include <iostream> - #include <string> #include <vector> #include <cstddef> // std::size_t @@ -263,21 +260,7 @@ namespace odb vtraits::set_image (i, is_null, wtraits::get_ref (v)); } - // big_int, big_float. - // - static void - set_value (W& v, const char* i, bool is_null) - { - vtraits::set_value (wtraits::set_ref (v), i, is_null); - } - - static void - set_image (char* i, std::size_t& n, bool& is_null, const W& v) - { - vtraits::set_image (i, n, is_null, wtraits::get_ref (v)); - } - - // timestamp, string, nstring, raw. + // big_int, big_float, timestamp, string, nstring, raw. // static void set_value (W& v, const char* i, std::size_t n, bool is_null) @@ -285,6 +268,8 @@ namespace odb vtraits::set_value (wtraits::set_ref (v), i, n, is_null); } + // timestamp, string, nstring, raw. + // static void set_image (char* i, std::size_t c, @@ -295,6 +280,14 @@ namespace odb vtraits::set_image (i, c, n, is_null, wtraits::get_ref (v)); } + // big_int, big_float. + // + static void + set_image (char* i, std::size_t& n, bool& is_null, const W& v) + { + vtraits::set_image (i, n, is_null, wtraits::get_ref (v)); + } + // blob, clob, nclob. // static void @@ -343,27 +336,7 @@ namespace odb vtraits::set_image (i, is_null, wtraits::get_ref (v)); } - // big_int, big_float. - // - static void - set_value (W& v, const char& i, bool is_null) - { - if (is_null) - wtraits::set_null (v); - else - vtraits::set_value (wtraits::set_ref (v), i, is_null); - } - - static void - set_image (char* i, std::size_t& n, bool& is_null, const W& v) - { - is_null = wtraits::get_null (v); - - if (!is_null) - vtraits::set_image (i, n, is_null, wtraits::get_ref (v)); - } - - // timestamp, string, nstring, raw. + // big_int, big_float, timestamp, string, nstring, raw. // static void set_value (W& v, const char* i, std::size_t n, bool is_null) @@ -374,6 +347,8 @@ namespace odb vtraits::set_value (wtraits::set_ref (v), i, n, is_null); } + // timestamp, string, nstring, raw. + // static void set_image (char* i, std::size_t c, @@ -387,6 +362,17 @@ namespace odb vtraits::set_image (i, c, n, is_null, wtraits::get_ref (v)); } + // big_int, big_float + // + static void + set_image (char* i, std::size_t& n, bool& is_null, const W& v) + { + is_null = wtraits::get_null (v); + + if (!is_null) + vtraits::set_image (i, n, is_null, wtraits::get_ref (v)); + } + // blob, clob, nclob. // static void @@ -444,10 +430,10 @@ namespace odb struct big_int_value_traits<T, false> { static void - set_value (T& v, const char* b, bool is_null) + set_value (T& v, const char* b, std::size_t n, bool is_null) { if (!is_null) - v = static_cast<T> (details::number_to_int64 (b)); + v = static_cast<T> (details::number_to_int64 (b, n)); else v = 0; } @@ -464,10 +450,10 @@ namespace odb struct big_int_value_traits<T, true> { static void - set_value (T& v, const char* b, bool is_null) + set_value (T& v, const char* b, std::size_t n, bool is_null) { if (!is_null) - v = static_cast<T> (details::number_to_uint64 (b)); + v = static_cast<T> (details::number_to_uint64 (b, n)); else v = 0; } |