aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/oracle/oracle-types.hxx12
-rw-r--r--odb/oracle/statement.cxx56
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));