diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-10-11 08:25:30 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-10-14 13:12:02 +0200 |
commit | d8227f949940cd83ebf7d349b1e97d116474758b (patch) | |
tree | 807a400d92462072004a2c431e94aa999dc5bb0b /odb/oracle/traits.hxx | |
parent | 6a2421094edb84224b0c7d02690522f3f7b8a86c (diff) |
Allow for size to be returned from big_int set_image functions
The OCI interface requires size information for any buffer passed to its bind
interface. By adding a return path for this data, we avert any need to obtain
this from the actual VARNUM binary data using messy byte manipulation.
Diffstat (limited to 'odb/oracle/traits.hxx')
-rw-r--r-- | odb/oracle/traits.hxx | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/odb/oracle/traits.hxx b/odb/oracle/traits.hxx index eafa2a4..b5dfc80 100644 --- a/odb/oracle/traits.hxx +++ b/odb/oracle/traits.hxx @@ -260,7 +260,21 @@ namespace odb vtraits::set_image (i, is_null, wtraits::get_ref (v)); } - // big_int, big_float, timestamp, string, nstring, raw. + // 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. // static void set_value (W& v, const char* i, std::size_t n, bool is_null) @@ -326,7 +340,27 @@ namespace odb vtraits::set_image (i, is_null, wtraits::get_ref (v)); } - // big_int, big_float, timestamp, string, nstring, raw. + // 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. // static void set_value (W& v, const char* i, std::size_t n, bool is_null) @@ -416,10 +450,10 @@ namespace odb } static void - set_image (char* b, bool& is_null, T v) + set_image (char* b, std::size_t& n, bool& is_null, T v) { is_null = false; - details::int64_to_number (b, static_cast<long long> (v)); + details::int64_to_number (b, n, static_cast<long long> (v)); } }; @@ -436,10 +470,10 @@ namespace odb } static void - set_image (char* b, bool& is_null, T v) + set_image (char* b, std::size_t& n, bool& is_null, T v) { is_null = false; - details::uint64_to_number (b, static_cast<unsigned long long> (v)); + details::uint64_to_number (b, n, static_cast<unsigned long long> (v)); } }; |