aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/oracle-types.hxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-09-14 15:26:43 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-09-14 15:26:43 +0200
commite601ea00bf044fd1ac48db859c2c8491f45fda3f (patch)
tree8ab6c62894a5e71bfd25a7c48ee365d37b0bbfc0 /odb/oracle/oracle-types.hxx
parent5b650a2f0b506fb871beaab6de71e1f628b6baf7 (diff)
Corrections and additions to LOB parameter and results callback implementation
Diffstat (limited to 'odb/oracle/oracle-types.hxx')
-rw-r--r--odb/oracle/oracle-types.hxx50
1 files changed, 28 insertions, 22 deletions
diff --git a/odb/oracle/oracle-types.hxx b/odb/oracle/oracle-types.hxx
index 5911d4f..4d347d0 100644
--- a/odb/oracle/oracle-types.hxx
+++ b/odb/oracle/oracle-types.hxx
@@ -19,25 +19,35 @@ namespace odb
{
ub2 type; // The type stored by buffer. This must be an external
// OCI type identifier of the form SQLT_XXX.
- void* buffer; // Image buffer pointer. If this bind is associated with
- // an output LOB column, interpret as an OCILobLocator*.
- ub2* size; // The number of bytes in buffer. Due to
- // inconsistencies in the OCI interface, this will be
- // interpreted as a ub4 when callbacks are in use.
- sb4 capacity; // The maximum number of bytes that can be stored in
+ void* buffer; // Data buffer pointer.
+ ub2* size; // The number of bytes in buffer. When parameter
+ // callbacks are in use, this is interpreted as a ub4*
+ // indicating the current position. When 'type'
+ // specifies a LOB type, this is interpreted as an
+ // OCILobLocator*.
+ ub4 capacity; // The maximum number of bytes that can be stored in
// buffer.
sb2* indicator; // Pointer to an OCI indicator variable.
+ enum piece
+ {
+ whole,
+ first,
+ next,
+ last
+ };
+
// Callback function signature used to specify LOB parameters that are
// passed to the database.
//
typedef bool (*param_callback_type) (
- void** context, // [in/out] The user context.
+ void* context, // [in/out] The user context.
void** buffer, // [out] On return, a pointer to a buffer containing
// parameter data.
ub4* size, // [out] The parameter data length in bytes.
- bool* last, // [out] True if buffer contains the last piece of
- // data.
+ ub4* position, // [in/out] A position context. This value remains
+ // unchanged between callback invocations.
+ piece*, // [out] The piece type for this segment of data.
void* temp_buffer, // [in] A temporary buffer that may be used if
// required. The 'buffer' parameter should specify
// this buffer on return if it is used.
@@ -47,25 +57,21 @@ namespace odb
// the database.
//
typedef bool (*result_callback_type) (
- void** context, // [in/out] The user context.
- void* buffer, // [in] A buffer containing the result data.
- ub4 size, // [in] The result data length in bytes.
- bool last); // [in] True if this is the last piece of result data.
+ void* context, // [in/out] The user context.
+ void* buffer, // [in] A buffer containing the result data.
+ ub4 size, // [in] The result data length in bytes.
+ piece); // [in] The piece type for this segment of data.
- param_callback_type param_callback;
- result_callback_type result_callback;
+ union
+ {
+ param_callback_type param;
+ result_callback_type result;
+ } callback;
// This pointer is provided to the user through the 'context' parameter
// in both parameter and result callback functions.
//
void* callback_context;
-
- // This flag is used exclusively during parameter callback invocation.
- // If set, it indicates that this is the first time the callback is
- // being invoked for this bind instance, and thus OCI is requesting
- // the first piece of parameter data.
- //
- bool first_piece;
};
}
}