aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-08 12:25:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-08 12:25:58 +0200
commitd20629df902528e9112d146d97e0523104a46619 (patch)
tree6178b2cffc00ac5513dcab4ed3e1f1e38b1da9ce
parent7b6785a77e9df669ce82df36f302e500f223e5fb (diff)
Fix issue with unbind data management in query with descriptors
-rw-r--r--odb/oracle/statement.cxx31
-rw-r--r--odb/oracle/statement.hxx5
2 files changed, 17 insertions, 19 deletions
diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx
index 309a5ce..7eb65c1 100644
--- a/odb/oracle/statement.cxx
+++ b/odb/oracle/statement.cxx
@@ -150,36 +150,30 @@ namespace odb
for (size_t i (0); i < usize_; ++i)
{
ub4 t;
- bind& b (*udata_[i].bind);
+ bind* b (udata_[i].bind);
- switch (b.type)
+ switch (udata_[i].type)
{
case bind::timestamp:
{
- datetime* dt (static_cast<datetime*> (b.buffer));
-
- if (dt->flags & descriptor_cache)
- dt->descriptor = 0;
+ if (b != 0)
+ static_cast<datetime*> (b->buffer)->descriptor = 0;
t = OCI_DTYPE_TIMESTAMP;
break;
}
case bind::interval_ym:
{
- interval_ym* iym (static_cast<interval_ym*> (b.buffer));
-
- if (iym->flags & descriptor_cache)
- iym->descriptor = 0;
+ if (b != 0)
+ static_cast<interval_ym*> (b->buffer)->descriptor = 0;
t = OCI_DTYPE_INTERVAL_YM;
break;
}
case bind::interval_ds:
{
- interval_ds* ids (static_cast<interval_ds*> (b.buffer));
-
- if (ids->flags & descriptor_cache)
- ids->descriptor = 0;
+ if (b != 0)
+ static_cast<interval_ds*> (b->buffer)->descriptor = 0;
t = OCI_DTYPE_INTERVAL_DS;
break;
@@ -352,7 +346,8 @@ namespace odb
{
unbind& u (udata_[usize_++]);
- u.bind = b;
+ u.type = bind::timestamp;
+ u.bind = (dt->flags & descriptor_cache) ? b : 0;
u.value = d;
value = &u.value;
}
@@ -416,7 +411,8 @@ namespace odb
{
unbind& u (udata_[usize_++]);
- u.bind = b;
+ u.type = bind::interval_ym;
+ u.bind = (iym->flags & descriptor_cache) ? b : 0;
u.value = d;
value = &u.value;
}
@@ -473,7 +469,8 @@ namespace odb
{
unbind& u (udata_[usize_++]);
- u.bind = b;
+ u.type = bind::interval_ds;
+ u.bind = (ids->flags & descriptor_cache) ? b : 0;
u.value = d;
value = &u.value;
}
diff --git a/odb/oracle/statement.hxx b/odb/oracle/statement.hxx
index ed8f298..bedddbc 100644
--- a/odb/oracle/statement.hxx
+++ b/odb/oracle/statement.hxx
@@ -51,8 +51,9 @@ namespace odb
protected:
struct unbind
{
- oracle::bind* bind; // Corresponding bind entry.
- void* value; // Actual value passed to OCIBindByPos.
+ oracle::bind::buffer_type type; // Bind type.
+ oracle::bind* bind; // Corresponding bind entry.
+ void* value; // Actual value passed to OCIBindByPos.
};
// Bind parameters for this statement. This function must only