aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/statement.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-02 08:30:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-11-02 08:30:19 +0200
commit735368e0d613c94519a7205ab0b709f832be8785 (patch)
treeb7d8f42bdba3d558d51edf64e735c92556dce146 /odb/oracle/statement.cxx
parent7a3d6b82f56eb68844225b5c09a402fc39dea47b (diff)
Revert previous commit: failing to reset lob prefetch size leads to ORA-03106
Diffstat (limited to 'odb/oracle/statement.cxx')
-rw-r--r--odb/oracle/statement.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx
index 36d9c15..476377d 100644
--- a/odb/oracle/statement.cxx
+++ b/odb/oracle/statement.cxx
@@ -417,6 +417,33 @@ 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.
+ //
+ // 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)
+ {
+ 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
}
}