From 7f348b4e2874d7aa39fbf093e56323f6e73ca052 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Tue, 15 Nov 2011 11:33:52 +0200 Subject: Interpret NULL bind::indicator pointer as a non-NULL value indicator --- odb/oracle/oracle-types.hxx | 12 ++-------- odb/oracle/statement.cxx | 56 ++++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/odb/oracle/oracle-types.hxx b/odb/oracle/oracle-types.hxx index 802f535..5e08a87 100644 --- a/odb/oracle/oracle-types.hxx +++ b/odb/oracle/oracle-types.hxx @@ -214,16 +214,8 @@ namespace odb unsigned short flags; public: - datetime (unsigned short f = descriptor_cache | descriptor_free): - descriptor (0), - flags (f), - year_ (1), - month_ (1), - day_ (1), - hour_ (0), - minute_ (0), - second_ (0), - nanosecond_ (0) + datetime (unsigned short f = descriptor_cache | descriptor_free) + : descriptor (0), flags (f) { } diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx index e9f7a45..c6fa745 100644 --- a/odb/oracle/statement.cxx +++ b/odb/oracle/statement.cxx @@ -358,18 +358,19 @@ namespace odb // Initialize the descriptor from the cached data. // - r = OCIDateTimeConstruct (env, - err, - static_cast (d), - dt->year_, - dt->month_, - dt->day_, - dt->hour_, - dt->minute_, - dt->second_, - dt->nanosecond_, - 0, - 0); + if (b->indicator == 0 || *b->indicator != -1) + r = OCIDateTimeConstruct (env, + err, + static_cast (d), + dt->year_, + dt->month_, + dt->day_, + dt->hour_, + dt->minute_, + dt->second_, + dt->nanosecond_, + 0, + 0); if (r != OCI_SUCCESS) translate_error (err, r); @@ -419,11 +420,12 @@ namespace odb // Initialize the descriptor from the cached data. // - r = OCIIntervalSetYearMonth (env, - err, - iym->year_, - iym->month_, - static_cast (d)); + if (b->indicator == 0 || *b->indicator != -1) + r = OCIIntervalSetYearMonth (env, + err, + iym->year_, + iym->month_, + static_cast (d)); if (r != OCI_SUCCESS) translate_error (err, r); @@ -473,14 +475,15 @@ namespace odb // Initialize the descriptor from the cached data. // - r = OCIIntervalSetDaySecond (env, - err, - ids->day_, - ids->hour_, - ids->minute_, - ids->second_, - ids->nanosecond_, - static_cast (d)); + if (b->indicator == 0 || *b->indicator != -1) + r = OCIIntervalSetDaySecond (env, + err, + ids->day_, + ids->hour_, + ids->minute_, + ids->second_, + ids->nanosecond_, + static_cast (d)); if (r != OCI_SUCCESS) translate_error (err, r); @@ -955,7 +958,8 @@ namespace odb if ((b->type == bind::blob || b->type == bind::clob || b->type == bind::nclob) && - *b->indicator != -1 && b->callback->result != 0) + (b->indicator == 0 || *b->indicator != -1) && + b->callback->result != 0) { auto_descriptor& locator ( *reinterpret_cast*> (b->buffer)); -- cgit v1.1