From 4e02fdf9dd78de05668370257c4c48bcf4572065 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Mon, 31 Oct 2011 12:33:32 +0200 Subject: Store the OCIDefine handle for LOB result parameters and reuse it on rebinding --- odb/oracle/oracle-types.hxx | 4 +++- odb/oracle/statement.cxx | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'odb') diff --git a/odb/oracle/oracle-types.hxx b/odb/oracle/oracle-types.hxx index 5587861..0687335 100644 --- a/odb/oracle/oracle-types.hxx +++ b/odb/oracle/oracle-types.hxx @@ -101,7 +101,9 @@ namespace odb // use, this is interpreted as an lob_auto_descriptor*. ub2* size; // The number of bytes in buffer. When parameter // callbacks are in use, this is interpreted as a ub4* - // indicating the current position. + // indicating the current position. For LOB result + // bindings, this is interpreted as the OCIDefine + // handle associated with the LOB result parameter. ub4 capacity; // The maximum number of bytes that can be stored in // buffer. sb2* indicator; // Pointer to an OCI indicator variable. diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx index f29136a..129b237 100644 --- a/odb/oracle/statement.cxx +++ b/odb/oracle/statement.cxx @@ -288,6 +288,12 @@ namespace odb if (r == OCI_ERROR || r == OCI_INVALID_HANDLE) translate_error (err, r); + // 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 (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 @@ -396,7 +402,8 @@ namespace odb lob->reset (h); } - OCIDefine* h(0); + OCIDefine* h (reinterpret_cast (b->size)); + sword r (OCIDefineByPos (stmt_, &h, err, -- cgit v1.1