diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-11-15 11:33:52 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-11-16 12:48:18 +0200 |
commit | 7f348b4e2874d7aa39fbf093e56323f6e73ca052 (patch) | |
tree | d569a52449818242099aef9b15090028250f83f4 | |
parent | d45a104481288b37b6060a4d5140d0296a82b4e6 (diff) |
Interpret NULL bind::indicator pointer as a non-NULL value indicator
-rw-r--r-- | odb/oracle/oracle-types.hxx | 12 | ||||
-rw-r--r-- | 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<OCIDateTime*> (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<OCIDateTime*> (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<OCIInterval*> (d)); + if (b->indicator == 0 || *b->indicator != -1) + r = OCIIntervalSetYearMonth (env, + err, + iym->year_, + iym->month_, + static_cast<OCIInterval*> (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<OCIInterval*> (d)); + if (b->indicator == 0 || *b->indicator != -1) + r = OCIIntervalSetDaySecond (env, + err, + ids->day_, + ids->hour_, + ids->minute_, + ids->second_, + ids->nanosecond_, + static_cast<OCIInterval*> (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<OCILobLocator>& locator ( *reinterpret_cast<auto_descriptor<OCILobLocator>*> (b->buffer)); |