diff options
-rw-r--r-- | odb/oracle/oracle-types.hxx | 10 | ||||
-rw-r--r-- | odb/oracle/statement.cxx | 25 | ||||
-rw-r--r-- | odb/oracle/traits.hxx | 4 |
3 files changed, 22 insertions, 17 deletions
diff --git a/odb/oracle/oracle-types.hxx b/odb/oracle/oracle-types.hxx index 5864d0a..091a6d5 100644 --- a/odb/oracle/oracle-types.hxx +++ b/odb/oracle/oracle-types.hxx @@ -59,6 +59,12 @@ namespace odb result_callback_type result; }; + union lob_context + { + const void* param; + void* result; + }; + struct bind { // This enumeration identifies the possible buffer types that can be @@ -101,12 +107,12 @@ namespace odb // buffer. sb2* indicator; // Pointer to an OCI indicator variable. - lob_callback callback; + lob_callback* callback; // This pointer is provided to the user through the context argument // in both parameter and result callback functions. // - void* callback_context; + lob_context* context; }; } } diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx index af70aca..ff02f06 100644 --- a/odb/oracle/statement.cxx +++ b/odb/oracle/statement.cxx @@ -80,13 +80,13 @@ namespace odb if (*b.indicator != -1) { chunk_position pos; - if (!(*b.callback.param) (&b.callback_context, - reinterpret_cast<ub4*> (b.size), - const_cast<const void**> (buffer), - size, - &pos, - b.buffer, - b.capacity)) + if (!(*b.callback->param) (b.context->param, + reinterpret_cast<ub4*> (b.size), + const_cast<const void**> (buffer), + size, + &pos, + b.buffer, + b.capacity)) return OCI_ERROR; switch (pos) @@ -350,8 +350,7 @@ namespace odb if ((b->type == bind::blob || b->type == bind::clob || b->type == bind::nclob) && - *b->indicator != -1 && - b->callback.result != 0) + *b->indicator != -1 && b->callback->result != 0) { // If b->capacity is 0, we will be stuck in an infinite loop. // @@ -404,10 +403,10 @@ namespace odb // OCI generates and ORA-24343 error when an error code is // returned from a user callback. We simulate this. // - if (!(*b->callback.result) (b->callback_context, - b->buffer, - static_cast<ub4> (read), - cp)) + if (!(*b->callback->result) (b->context->result, + b->buffer, + static_cast<ub4> (read), + cp)) throw database_exception (24343, "user defined callback error"); } while (r == OCI_NEED_DATA); diff --git a/odb/oracle/traits.hxx b/odb/oracle/traits.hxx index a8ada63..d156fb3 100644 --- a/odb/oracle/traits.hxx +++ b/odb/oracle/traits.hxx @@ -302,7 +302,7 @@ namespace odb static void set_image (param_callback_type& cb, - void*& context, + const void*& context, bool& is_null, const W& v) { @@ -397,7 +397,7 @@ namespace odb static void set_image (param_callback_type& cb, - void*& context, + const void*& context, bool& is_null, const W& v) { |