aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-11-26 10:58:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-26 10:58:50 +0200
commit76a03fd7964b85cdc1a903df79bfd47711c720e9 (patch)
tree4c73f15b891746990b62e9a33b75c7feb2989b8d
parent7a3b76479162e3e3fe6c425f7bb20eaea8f41e17 (diff)
Reimplement image copying for Oracle
Now we no longer "steal" descriptors (destructive copy). Instead, for LOBs, we clone the locator using OCILobAssign(). For date-time types we extract the data during copying. As a result of this change we no longer need to track image changes and rebind the statements.
-rw-r--r--odb/oracle/no-id-object-result.hxx2
-rw-r--r--odb/oracle/no-id-object-result.txx9
-rw-r--r--odb/oracle/oracle-types.cxx278
-rw-r--r--odb/oracle/oracle-types.hxx81
-rw-r--r--odb/oracle/polymorphic-object-result.hxx2
-rw-r--r--odb/oracle/polymorphic-object-result.txx25
-rw-r--r--odb/oracle/simple-object-result.hxx2
-rw-r--r--odb/oracle/simple-object-result.txx15
-rw-r--r--odb/oracle/statement.cxx196
-rw-r--r--odb/oracle/statement.hxx13
-rw-r--r--odb/oracle/view-result.hxx2
-rw-r--r--odb/oracle/view-result.txx9
12 files changed, 217 insertions, 417 deletions
diff --git a/odb/oracle/no-id-object-result.hxx b/odb/oracle/no-id-object-result.hxx
index f3a695b..53f3482 100644
--- a/odb/oracle/no-id-object-result.hxx
+++ b/odb/oracle/no-id-object-result.hxx
@@ -66,7 +66,7 @@ namespace odb
typedef oracle::change_callback change_callback_type;
static void
- change_callback (void* context, binding*);
+ change_callback (void* context);
private:
details::shared_ptr<select_statement> statement_;
diff --git a/odb/oracle/no-id-object-result.txx b/odb/oracle/no-id-object-result.txx
index c58e0af..d845ab9 100644
--- a/odb/oracle/no-id-object-result.txx
+++ b/odb/oracle/no-id-object-result.txx
@@ -129,7 +129,7 @@ namespace odb
template <typename T>
void no_id_object_result_impl<T>::
- change_callback (void* c, binding* b)
+ change_callback (void* c)
{
no_id_object_result_impl<T>* r (
static_cast<no_id_object_result_impl<T>*> (c));
@@ -141,13 +141,6 @@ namespace odb
else
*r->image_copy_ = im;
- // See comment in simple object_result for details on what's going
- // on here.
- //
- im.version++;
- if (b != 0)
- b->version++;
-
im.change_callback_.callback = 0;
im.change_callback_.context = 0;
diff --git a/odb/oracle/oracle-types.cxx b/odb/oracle/oracle-types.cxx
index 8bd7657..98cdbd3 100644
--- a/odb/oracle/oracle-types.cxx
+++ b/odb/oracle/oracle-types.cxx
@@ -4,9 +4,8 @@
#include <oci.h>
-#include <cassert>
-
#include <odb/oracle/oracle-types.hxx>
+#include <odb/oracle/exceptions.hxx>
#include <odb/oracle/error.hxx>
namespace odb
@@ -25,32 +24,79 @@ namespace odb
}
lob::
- lob (lob& x)
- : locator (x.locator),
+ lob (const lob& x)
+ : environment (x.environment),
+ error (x.error),
+ locator (0),
buffer (x.buffer),
position (x.position)
{
- x.locator = 0;
+ // Watch out for exception safety.
+ //
+ if (x.locator != 0)
+ clone (x);
}
lob& lob::
- operator= (lob& x)
+ operator= (const lob& x)
{
+ // Watch out for exception safety.
+ //
if (this != &x)
{
- if (locator != 0)
- OCIDescriptorFree (locator, OCI_DTYPE_LOB);
+ if (x.locator != 0)
+ clone (x);
+ else
+ {
+ if (locator != 0)
+ {
+ OCIDescriptorFree (locator, OCI_DTYPE_LOB);
+ locator = 0;
+ }
+ }
- locator = x.locator;
+ environment = x.environment;
+ error = x.error;
buffer = x.buffer;
position = x.position;
-
- x.locator = 0;
}
return *this;
}
+ void lob::
+ clone (const lob& x)
+ {
+ // Watch out for exception safety.
+ //
+ sword r;
+ bool alloc (locator == 0);
+
+ if (alloc)
+ {
+ void* d (0);
+ r = OCIDescriptorAlloc (x.environment, &d, OCI_DTYPE_LOB, 0, 0);
+
+ if (r != OCI_SUCCESS)
+ throw invalid_oci_handle ();
+
+ locator = static_cast<OCILobLocator*> (d);
+ }
+
+ r = OCILobAssign (x.environment, x.error, x.locator, &locator);
+
+ if (r != OCI_SUCCESS)
+ {
+ if (alloc)
+ {
+ OCIDescriptorFree (locator, OCI_DTYPE_LOB);
+ locator = 0;
+ }
+
+ translate_error (x.error, r);
+ }
+ }
+
//
// datetime
//
@@ -63,73 +109,66 @@ namespace odb
}
datetime::
- datetime (datetime& x)
- : environment (x.environment),
- error (x.error),
- descriptor (x.descriptor),
- flags (x.flags),
- year_ (x.year_),
- month_ (x.month_),
- day_ (x.day_),
- hour_ (x.hour_),
- minute_ (x.minute_),
- second_ (x.second_),
- nanosecond_ (x.nanosecond_)
- {
- x.descriptor = 0;
- }
+ datetime (const datetime& x)
+ : descriptor (0), flags (x.flags)
+ {
+ x.get (year_, month_, day_, hour_, minute_, second_, nanosecond_);
+ }
datetime& datetime::
- operator= (datetime& x)
+ operator= (const datetime& x)
{
if (this != &x)
{
if (descriptor != 0 && (flags & descriptor_free))
+ {
OCIDescriptorFree (descriptor, OCI_DTYPE_TIMESTAMP);
+ descriptor = 0;
+ }
- environment = x.environment;
- error = x.error;
- descriptor = x.descriptor;
flags = x.flags;
- year_ = x.year_;
- month_ = x.month_;
- day_ = x.day_;
- hour_ = x.hour_;
- minute_ = x.minute_;
- second_ = x.second_;
- nanosecond_ = x.nanosecond_;
-
- x.descriptor = 0;
+ x.get (year_, month_, day_, hour_, minute_, second_, nanosecond_);
}
return *this;
}
void datetime::
- get (sb2& y, ub1& m, ub1& d, ub1& h, ub1& minute, ub1& s, ub4& ns) const
+ get (sb2& y, ub1& m, ub1& d, ub1& h, ub1& mi, ub1& s, ub4& ns) const
{
- assert (descriptor != 0);
-
- sword r (OCIDateTimeGetDate (environment,
- error,
- descriptor,
- &y,
- &m,
- &d));
+ if (descriptor != 0)
+ {
+ sword r (OCIDateTimeGetDate (environment,
+ error,
+ descriptor,
+ &y,
+ &m,
+ &d));
- if (r != OCI_SUCCESS)
- translate_error (error, r);
+ if (r != OCI_SUCCESS)
+ translate_error (error, r);
- r = OCIDateTimeGetTime (environment,
- error,
- descriptor,
- &h,
- &minute,
- &s,
- &ns);
+ r = OCIDateTimeGetTime (environment,
+ error,
+ descriptor,
+ &h,
+ &mi,
+ &s,
+ &ns);
- if (r != OCI_SUCCESS)
- translate_error (error, r);
+ if (r != OCI_SUCCESS)
+ translate_error (error, r);
+ }
+ else
+ {
+ y = year_;
+ m = month_;
+ d = day_;
+ h = hour_;
+ mi = minute_;
+ s = second_;
+ ns = nanosecond_;
+ }
}
void datetime::
@@ -177,33 +216,25 @@ namespace odb
}
interval_ym::
- interval_ym (interval_ym& x)
- : environment (x.environment),
- error (x.error),
- descriptor (x.descriptor),
- flags (x.flags),
- year_ (x.year_),
- month_ (x.month_)
- {
- x.descriptor = 0;
- }
+ interval_ym (const interval_ym& x)
+ : descriptor (0), flags (x.flags)
+ {
+ x.get (year_, month_);
+ }
interval_ym& interval_ym::
- operator= (interval_ym& x)
+ operator= (const interval_ym& x)
{
if (this != &x)
{
if (descriptor != 0 && (flags & descriptor_free))
+ {
OCIDescriptorFree (descriptor, OCI_DTYPE_INTERVAL_YM);
+ descriptor = 0;
+ }
- environment = x.environment;
- error = x.error;
- descriptor = x.descriptor;
flags = x.flags;
- year_ = x.year_;
- month_ = x.month_;
-
- x.descriptor = 0;
+ x.get (year_, month_);
}
return *this;
@@ -212,16 +243,22 @@ namespace odb
void interval_ym::
get (sb4& y, sb4& m) const
{
- assert (descriptor != 0);
-
- sword r (OCIIntervalGetYearMonth (environment,
- error,
- &y,
- &m,
- descriptor));
+ if (descriptor != 0)
+ {
+ sword r (OCIIntervalGetYearMonth (environment,
+ error,
+ &y,
+ &m,
+ descriptor));
- if (r != OCI_SUCCESS)
- translate_error (error, r);
+ if (r != OCI_SUCCESS)
+ translate_error (error, r);
+ }
+ else
+ {
+ y = year_;
+ m = month_;
+ }
}
void interval_ym::
@@ -257,39 +294,25 @@ namespace odb
}
interval_ds::
- interval_ds (interval_ds& x)
- : environment (x.environment),
- error (x.error),
- descriptor (x.descriptor),
- flags (x.flags),
- day_ (x.day_),
- hour_ (x.hour_),
- minute_ (x.minute_),
- second_ (x.second_),
- nanosecond_ (x.nanosecond_)
- {
- x.descriptor = 0;
- }
+ interval_ds (const interval_ds& x)
+ : descriptor (0), flags (x.flags)
+ {
+ x.get (day_, hour_, minute_, second_, nanosecond_);
+ }
interval_ds& interval_ds::
- operator= (interval_ds& x)
+ operator= (const interval_ds& x)
{
if (this != &x)
{
if (descriptor != 0 && (flags & descriptor_free))
- OCIDescriptorFree (descriptor, OCI_DTYPE_INTERVAL_DS);
+ {
+ OCIDescriptorFree (descriptor, OCI_DTYPE_TIMESTAMP);
+ descriptor = 0;
+ }
- environment = x.environment;
- error = x.error;
- descriptor = x.descriptor;
flags = x.flags;
- day_ = x.day_;
- hour_ = x.hour_;
- minute_ = x.minute_;
- second_ = x.second_;
- nanosecond_ = x.nanosecond_;
-
- x.descriptor = 0;
+ x.get (day_, hour_, minute_, second_, nanosecond_);
}
return *this;
@@ -298,19 +321,28 @@ namespace odb
void interval_ds::
get (sb4& d, sb4& h, sb4& m, sb4& s, sb4& ns) const
{
- assert (descriptor != 0);
-
- sword r (OCIIntervalGetDaySecond (environment,
- error,
- &d,
- &h,
- &m,
- &s,
- &ns,
- descriptor));
+ if (descriptor != 0)
+ {
+ sword r (OCIIntervalGetDaySecond (environment,
+ error,
+ &d,
+ &h,
+ &m,
+ &s,
+ &ns,
+ descriptor));
- if (r != OCI_SUCCESS)
- translate_error (error, r);
+ if (r != OCI_SUCCESS)
+ translate_error (error, r);
+ }
+ else
+ {
+ d = day_;
+ h = hour_;
+ m = minute_;
+ s = second_;
+ ns = nanosecond_;
+ }
}
void interval_ds::
diff --git a/odb/oracle/oracle-types.hxx b/odb/oracle/oracle-types.hxx
index ffc974a..30e514b 100644
--- a/odb/oracle/oracle-types.hxx
+++ b/odb/oracle/oracle-types.hxx
@@ -111,9 +111,7 @@ namespace odb
buffer_type type; // The type stored by buffer.
void* buffer; // Data buffer pointer. For LOB type bindings, this is
// interpreted as an oracle::lob*.
- ub2* size; // The number of bytes in buffer. For LOB result
- // bindings, this is interpreted as the OCIDefine
- // handle associated with the LOB result parameter.
+ ub2* size; // The number of bytes in buffer.
ub4 capacity; // The maximum number of bytes that can be stored in
// the buffer. For LOBs, it used to store array skip
// size.
@@ -133,7 +131,7 @@ namespace odb
{
change_callback (): callback (0), context (0) {};
- void (*callback) (void*, binding*);
+ void (*callback) (void*);
void* context;
};
@@ -142,15 +140,21 @@ namespace odb
//
struct LIBODB_ORACLE_EXPORT lob
{
+ ~lob ();
lob (): locator (0), buffer (0), position (0) {}
- lob (lob&);
- lob& operator= (lob&);
+ lob (const lob&);
+ lob& operator= (const lob&);
- ~lob ();
+ private:
+ void
+ clone (const lob&);
public:
+ OCIEnv* environment;
+ OCIError* error;
OCILobLocator* locator;
+
details::buffer* buffer;
ub4 position;
};
@@ -192,6 +196,16 @@ namespace odb
ub1 second,
ub4 nanosecond);
+ ~datetime ();
+ datetime (unsigned short f = descriptor_cache | descriptor_free)
+ : descriptor (0), flags (f) {}
+
+ datetime (const datetime&);
+ datetime& operator= (const datetime&);
+
+ // Use the get() and set() functions above unless you know what you
+ // are doing and understand how copying of datetime works.
+ //
public:
OCIEnv* environment;
OCIError* error;
@@ -200,17 +214,6 @@ namespace odb
unsigned short flags;
public:
- datetime (unsigned short f = descriptor_cache | descriptor_free)
- : descriptor (0), flags (f)
- {
- }
-
- datetime (datetime&);
- datetime& operator= (datetime&);
-
- ~datetime ();
-
- public:
sb2 year_;
ub1 month_;
ub1 day_;
@@ -228,6 +231,16 @@ namespace odb
void
set (sb4 year, sb4 month);
+ ~interval_ym ();
+ interval_ym (unsigned short f = descriptor_cache | descriptor_free)
+ : descriptor (0), flags (f) {}
+
+ interval_ym (const interval_ym&);
+ interval_ym& operator= (const interval_ym&);
+
+ // Use the get() and set() functions above unless you know what you
+ // are doing and understand how copying of interval_ym works.
+ //
public:
OCIEnv* environment;
OCIError* error;
@@ -236,17 +249,6 @@ namespace odb
unsigned short flags;
public:
- interval_ym (unsigned short f = descriptor_cache | descriptor_free)
- : descriptor (0), flags (f)
- {
- }
-
- interval_ym (interval_ym&);
- interval_ym& operator= (interval_ym&);
-
- ~interval_ym ();
-
- public:
sb4 year_;
sb4 month_;
};
@@ -267,6 +269,16 @@ namespace odb
sb4 second,
sb4 nanosecond);
+ ~interval_ds ();
+ interval_ds (unsigned short f = descriptor_cache | descriptor_free)
+ : descriptor (0), flags (f) {}
+
+ interval_ds (const interval_ds&);
+ interval_ds& operator= (const interval_ds&);
+
+ // Use the get() and set() functions above unless you know what you
+ // are doing and understand how copying of interval_ds works.
+ //
public:
OCIEnv* environment;
OCIError* error;
@@ -275,17 +287,6 @@ namespace odb
unsigned short flags;
public:
- interval_ds (unsigned short f = descriptor_cache | descriptor_free)
- : descriptor (0), flags (f)
- {
- }
-
- interval_ds (interval_ds&);
- interval_ds& operator= (interval_ds&);
-
- ~interval_ds ();
-
- public:
sb4 day_;
sb4 hour_;
sb4 minute_;
diff --git a/odb/oracle/polymorphic-object-result.hxx b/odb/oracle/polymorphic-object-result.hxx
index 6879645..ca53699 100644
--- a/odb/oracle/polymorphic-object-result.hxx
+++ b/odb/oracle/polymorphic-object-result.hxx
@@ -80,7 +80,7 @@ namespace odb
typedef oracle::change_callback change_callback_type;
static void
- change_callback (void* context, binding*);
+ change_callback (void* context);
private:
details::shared_ptr<select_statement> statement_;
diff --git a/odb/oracle/polymorphic-object-result.txx b/odb/oracle/polymorphic-object-result.txx
index 19b4fa3..eeb1119 100644
--- a/odb/oracle/polymorphic-object-result.txx
+++ b/odb/oracle/polymorphic-object-result.txx
@@ -226,16 +226,6 @@ namespace odb
sts.select_image_versions (), im, sts.select_image_bindings ());
}
}
-
- static void
- inc_version (typename traits::image_type& i)
- {
- polymorphic_image_rebind<
- typename traits::base_type,
- typename traits::root_type>::inc_version (*i.base);
-
- i.version++;
- }
};
template <typename R>
@@ -260,12 +250,6 @@ namespace odb
b.version++;
}
}
-
- static void
- inc_version (typename traits::image_type& i)
- {
- i.version++;
- }
};
template <typename T>
@@ -314,7 +298,7 @@ namespace odb
template <typename T>
void polymorphic_object_result_impl<T>::
- change_callback (void* c, binding* b)
+ change_callback (void* c)
{
polymorphic_object_result_impl<T>* r (
static_cast<polymorphic_object_result_impl<T>*> (c));
@@ -328,13 +312,6 @@ namespace odb
typename root_traits::image_type& rim (
r->statements_.root_statements ().image ());
- // See comment in simple object_result for details on what's going
- // on here.
- //
- polymorphic_image_rebind<object_type, root_type>::inc_version (im);
- if (b != 0)
- b->version++;
-
rim.change_callback_.callback = 0;
rim.change_callback_.context = 0;
diff --git a/odb/oracle/simple-object-result.hxx b/odb/oracle/simple-object-result.hxx
index 6ee56ba..d69dd23 100644
--- a/odb/oracle/simple-object-result.hxx
+++ b/odb/oracle/simple-object-result.hxx
@@ -70,7 +70,7 @@ namespace odb
typedef oracle::change_callback change_callback_type;
static void
- change_callback (void* context, binding*);
+ change_callback (void* context);
private:
details::shared_ptr<select_statement> statement_;
diff --git a/odb/oracle/simple-object-result.txx b/odb/oracle/simple-object-result.txx
index 114c919..ed16c55 100644
--- a/odb/oracle/simple-object-result.txx
+++ b/odb/oracle/simple-object-result.txx
@@ -163,7 +163,7 @@ namespace odb
template <typename T>
void object_result_impl<T>::
- change_callback (void* c, binding* b)
+ change_callback (void* c)
{
object_result_impl<T>* r (static_cast<object_result_impl<T>*> (c));
typename object_traits::image_type& im (r->statements_.image ());
@@ -173,19 +173,6 @@ namespace odb
else
*r->image_copy_ = im;
- // Increment image version since we may have "stolen" descriptors
- // (LOB, date-time) from the image. This will trigger re-bind which
- // will reallocate them and update the binding. In case this callback
- // was triggeted as part of a select statement fetch, then it is too
- // late to update the image version and we also need to update the
- // image binding.
- //
- // @@ Would be good to only do this if we actually have descriptors.
- //
- im.version++;
- if (b != 0)
- b->version++;
-
im.change_callback_.callback = 0;
im.change_callback_.context = 0;
diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx
index 70577fa..cb61a53 100644
--- a/odb/oracle/statement.cxx
+++ b/odb/oracle/statement.cxx
@@ -875,6 +875,8 @@ namespace odb
throw invalid_oci_handle ();
l->locator = static_cast<OCILobLocator*> (d);
+ l->environment = env;
+ l->error = err;
}
value = &l->locator;
@@ -917,23 +919,18 @@ namespace odb
if (r == OCI_ERROR || r == OCI_INVALID_HANDLE)
translate_error (err, r);
+ // LOB prefetching is only supported in OCI version 11.1 and greater
+ // and in Oracle server 11.1 and greater. If this code is called
+ // against a pre 11.1 server, the call to OCIAttrSet will return an
+ // error code.
+ //
+#if (OCI_MAJOR_VERSION == 11 && OCI_MINOR_VERSION >= 1) \
+ || OCI_MAJOR_VERSION > 11
if (b->type == bind::blob ||
b->type == bind::clob ||
b->type == bind::nclob)
{
- // The OCIDefine handle is stored in the size member of the bind in
- // case the LOB parameter is rebound. If rebinding is necessary, the
- // same OCIDefine handle is used.
- //
- b->size = reinterpret_cast<ub2*> (h);
- // LOB prefetching is only supported in OCI version 11.1 and greater
- // and in Oracle server 11.1 and greater. If this code is called
- // against a pre 11.1 server, the call to OCIAttrSet will return an
- // error code.
- //
-#if (OCI_MAJOR_VERSION == 11 && OCI_MINOR_VERSION >= 1) \
- || OCI_MAJOR_VERSION > 11
if (p != 0)
{
ub4 n (static_cast<ub4> (p));
@@ -948,9 +945,10 @@ namespace odb
if (r == OCI_ERROR || r == OCI_INVALID_HANDLE)
translate_error (err, r);
}
-#endif
}
- else if (b->type == bind::nstring)
+ else
+#endif
+ if (b->type == bind::nstring)
{
ub1 form (SQLCS_NCHAR);
@@ -970,160 +968,6 @@ namespace odb
}
void statement::
- rebind_result (bind* b, size_t c, size_t p)
- {
- ODB_POTENTIALLY_UNUSED (p);
-
- sword r;
- OCIEnv* env (conn_.database ().environment ());
-
- ub4 i (0);
- for (bind* end (b + c); b != end; ++b)
- {
- if (b->buffer == 0) // Skip NULL entries.
- continue;
-
- i++; // Column index is 1-based.
-
- void* value;
-
- switch (b->type)
- {
- case bind::timestamp:
- {
- datetime* dt (static_cast<datetime*> (b->buffer));
-
- if (dt->descriptor == 0)
- {
- void* d (0);
- r = OCIDescriptorAlloc (env, &d, OCI_DTYPE_TIMESTAMP, 0, 0);
-
- if (r != OCI_SUCCESS)
- throw invalid_oci_handle ();
-
- dt->descriptor = static_cast<OCIDateTime*> (d);
- }
-
- value = &dt->descriptor;
- break;
- }
- case bind::interval_ym:
- {
- interval_ym* iym (static_cast<interval_ym*> (b->buffer));
-
- if (iym->descriptor == 0)
- {
- void* d (0);
- r = OCIDescriptorAlloc (env, &d, OCI_DTYPE_INTERVAL_YM, 0, 0);
-
- if (r != OCI_SUCCESS)
- throw invalid_oci_handle ();
-
- iym->descriptor = static_cast<OCIInterval*> (d);
- }
-
- value = &iym->descriptor;
- break;
- }
- case bind::interval_ds:
- {
- interval_ds* ids (static_cast<interval_ds*> (b->buffer));
-
- if (ids->descriptor == 0)
- {
- void* d (0);
- r = OCIDescriptorAlloc (env, &d, OCI_DTYPE_INTERVAL_DS, 0, 0);
-
- if (r != OCI_SUCCESS)
- throw invalid_oci_handle ();
-
- ids->descriptor = static_cast<OCIInterval*> (d);
- }
-
- value = &ids->descriptor;
- break;
- }
- case bind::blob:
- case bind::clob:
- case bind::nclob:
- {
- lob* l (static_cast<lob*> (b->buffer));
-
- if (l->locator == 0)
- {
- void* d (0);
- r = OCIDescriptorAlloc (env, &d, OCI_DTYPE_LOB, 0, 0);
-
- if (r != OCI_SUCCESS)
- throw invalid_oci_handle ();
-
- l->locator = static_cast<OCILobLocator*> (d);
- }
-
- value = &l->locator;
- break;
- }
- default:
- {
- continue;
- }
- }
-
- // The bind::size member of bind instances associated with LOB and
- // TIMESTAMP type is interpreted as the OCIDefine* returned by the
- // initial call to OCIDefineByPos when binding for the first time.
- //
- OCIDefine* h (reinterpret_cast<OCIDefine*> (b->size));
- OCIError* err (conn_.error_handle ());
-
- r = OCIDefineByPos (stmt_,
- &h,
- err,
- i,
- value,
- static_cast<sb4> (sizeof (void*)),
- result_sqlt_lookup[b->type],
- b->indicator,
- 0,
- 0,
- OCI_DEFINE_SOFT);
-
- if (r == OCI_ERROR || r == OCI_INVALID_HANDLE)
- translate_error (err, r);
-
-
- // LOB prefetching is only supported in OCI version 11.1 and greater
- // and in Oracle server 11.1 and greater. If this code is called
- // against a pre 11.1 server, the call to OCIAttrSet will return an
- // error code.
- //
- // Note that even though we are re-binding the same handle, we still
- // have to reset this attribute. Failing to do so will result in the
- // mysterious ORA-03106 fatal two-task communication protocol error.
- //
-#if (OCI_MAJOR_VERSION == 11 && OCI_MINOR_VERSION >= 1) \
- || OCI_MAJOR_VERSION > 11
- if (p != 0 && (b->type == bind::blob ||
- b->type == bind::clob ||
- b->type == bind::nclob))
- {
- ub4 n (static_cast<ub4> (p));
-
- r = OCIAttrSet (h,
- OCI_HTYPE_DEFINE,
- &n,
- 0,
- OCI_ATTR_LOBPREFETCH_SIZE,
- err);
-
- if (r == OCI_ERROR || r == OCI_INVALID_HANDLE)
- translate_error (err, r);
- }
-#endif
- }
- }
-
- void statement::
stream_result (bind* b, size_t c, void* obase, void* nbase)
{
OCIError* err (conn_.error_handle ());
@@ -1645,7 +1489,6 @@ namespace odb
text, statement_select,
(process ? &result : 0), optimize),
result_ (result),
- lob_prefetch_size_ (lob_prefetch_size),
done_ (true)
{
if (!empty ())
@@ -1653,7 +1496,6 @@ namespace odb
bind_param (param.bind, param.count);
result_count_ = bind_result (
result.bind, result.count, lob_prefetch_size);
- result_version_ = result_.version;
}
}
@@ -1669,7 +1511,6 @@ namespace odb
text, statement_select,
(process ? &result : 0), optimize),
result_ (result),
- lob_prefetch_size_ (lob_prefetch_size),
done_ (true)
{
if (!empty ())
@@ -1677,7 +1518,6 @@ namespace odb
bind_param (param.bind, param.count);
result_count_ = bind_result (
result.bind, result.count, lob_prefetch_size);
- result_version_ = result_.version;
}
}
@@ -1692,14 +1532,12 @@ namespace odb
text, statement_select,
(process ? &result : 0), optimize),
result_ (result),
- lob_prefetch_size_ (lob_prefetch_size),
done_ (true)
{
if (!empty ())
{
result_count_ = bind_result (
result.bind, result.count, lob_prefetch_size);
- result_version_ = result_.version;
}
}
@@ -1714,14 +1552,12 @@ namespace odb
text, statement_select,
(process ? &result : 0), optimize),
result_ (result),
- lob_prefetch_size_ (lob_prefetch_size),
done_ (true)
{
if (!empty ())
{
result_count_ = bind_result (
result.bind, result.count, lob_prefetch_size);
- result_version_ = result_.version;
}
}
@@ -1780,13 +1616,7 @@ namespace odb
change_callback* cc (result_.change_callback);
if (cc != 0 && cc->callback != 0)
- (cc->callback) (cc->context, &result_);
-
- if (result_version_ != result_.version)
- {
- rebind_result (result_.bind, result_.count, lob_prefetch_size_);
- result_version_ = result_.version;
- }
+ (cc->callback) (cc->context);
sword r (OCIStmtFetch2 (stmt_,
conn_.error_handle (),
diff --git a/odb/oracle/statement.hxx b/odb/oracle/statement.hxx
index 6a5d604..ba85fd8 100644
--- a/odb/oracle/statement.hxx
+++ b/odb/oracle/statement.hxx
@@ -110,17 +110,6 @@ namespace odb
std::size_t count,
std::size_t lob_prefetch_size = 0);
- // Rebind LOB input parameters. If a query has made a private copy of
- // the shared image, any LOB handles that were previously owned by the
- // shared image are now owned by the private image of the query. These
- // LOB handles need to be reallocated and redefined so that any unfetched
- // results may be fetched.
- //
- void
- rebind_result (bind*,
- std::size_t count,
- std::size_t lob_prefetch_size = 0);
-
// Stream the result LOBs, calling user callbacks where necessary.
// The old_base and new_base arguments can be used to "re-base" the
// lob_callback struct pointer (stored in bind::callback), the lob
@@ -278,9 +267,7 @@ namespace odb
private:
binding& result_;
- std::size_t result_version_;
ub4 result_count_; // Actual number of bound columns.
- const std::size_t lob_prefetch_size_;
bool done_;
};
diff --git a/odb/oracle/view-result.hxx b/odb/oracle/view-result.hxx
index 424728b..8a2d66a 100644
--- a/odb/oracle/view-result.hxx
+++ b/odb/oracle/view-result.hxx
@@ -66,7 +66,7 @@ namespace odb
typedef oracle::change_callback change_callback_type;
static void
- change_callback (void* context, binding*);
+ change_callback (void* context);
private:
details::shared_ptr<select_statement> statement_;
diff --git a/odb/oracle/view-result.txx b/odb/oracle/view-result.txx
index 402a571..982a33d 100644
--- a/odb/oracle/view-result.txx
+++ b/odb/oracle/view-result.txx
@@ -129,7 +129,7 @@ namespace odb
template <typename T>
void view_result_impl<T>::
- change_callback (void* c, binding*)
+ change_callback (void* c)
{
view_result_impl<T>* r (static_cast<view_result_impl<T>*> (c));
@@ -140,13 +140,6 @@ namespace odb
else
*r->image_copy_ = im;
- // See comment in simple object_result for details on what's going
- // on here. Except for views, there is nothing else other than the
- // select binding, so just incrementing the binding version will
- // be sufficient.
- //
- r->statements_.image_binding ().version++;
-
im.change_callback_.callback = 0;
im.change_callback_.context = 0;