aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/oracle-types.hxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-09-13 16:11:02 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-09-13 16:11:02 +0200
commit3d76b241bc6af7f7f3beda3cc9d6609cf5db0f43 (patch)
tree9ce89742a6133a784da2e9f64439fcec2d8cf3a2 /odb/oracle/oracle-types.hxx
parent7234741fcd3824b36c7292e8245cc59bbe7de13e (diff)
Implement LOB read and write support using OCI callbacks
Diffstat (limited to 'odb/oracle/oracle-types.hxx')
-rw-r--r--odb/oracle/oracle-types.hxx56
1 files changed, 50 insertions, 6 deletions
diff --git a/odb/oracle/oracle-types.hxx b/odb/oracle/oracle-types.hxx
index 4cdd7bb..1f5fe57 100644
--- a/odb/oracle/oracle-types.hxx
+++ b/odb/oracle/oracle-types.hxx
@@ -17,13 +17,57 @@ namespace odb
{
struct bind
{
- ub2 type; // The type stored by buffer. This must be an
- // external OCI type identifier of the form SQLT_XXX.
+ ub2 type; // The type stored by buffer. This must be an external
+ // OCI type identifier of the form SQLT_XXX.
void* buffer;
- ub2* size; // The number of bytes in buffer.
- sb4 capacity; // The maximum number of bytes that can be stored in
- // buffer.
- sb2* indicator; // Pointer to an OCI indicator variable.
+ 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
+ // buffer.
+ sb2* indicator; // Pointer to an OCI indicator variable.
+
+ // Callback function signature used to specify parameters that are
+ // passed to the database.
+ //
+ typedef bool (*param_callback_type) (
+ void** context, // [in/out] The user context.
+ void** buffer, // [out] A a buffer containing the parameter data
+ // to write to the database.
+ ub4* size, // [out] The parameter data length in bytes.
+ bool* null, // [out] True if the parameter is null. Both buffer
+ // and size are ignored is this is true.
+ bool* last, // [out] True if buffer contains the last piece 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.
+ ub4 capacity); // [in] The temporary buffer length in bytes.
+
+ // Callback function signature used to specify values returned from 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 null, // [in] True if the result data is NULL.
+ bool last); // [in] True if this is the last piece of result data.
+
+ param_callback_type param_callback;
+ 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;
};
}
}