aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/oracle-types.hxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-09-28 09:57:42 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-09-29 08:56:13 +0200
commitec1683514402dfed20b8a08824e2aa1bb017d6e7 (patch)
treee37ad34c7fe5acd41ee8a9a9f6299d2cbc10c7be /odb/oracle/oracle-types.hxx
parent9681c508fa9614da936314b9913a5d6cb0342c62 (diff)
Implement custom bind buffer type identifiers.
This allows for the association of a character set with a character data buffer, something that is impossible using only OCI external typecodes.
Diffstat (limited to 'odb/oracle/oracle-types.hxx')
-rw-r--r--odb/oracle/oracle-types.hxx50
1 files changed, 39 insertions, 11 deletions
diff --git a/odb/oracle/oracle-types.hxx b/odb/oracle/oracle-types.hxx
index c027e5d..d21b948 100644
--- a/odb/oracle/oracle-types.hxx
+++ b/odb/oracle/oracle-types.hxx
@@ -58,17 +58,45 @@ namespace odb
struct bind
{
- ub2 type; // The type stored by buffer. This must be an external
- // OCI type identifier of the form SQLT_XXX.
- 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 result
- // callbacks are in use, 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.
+ // This enumeration identifies the possible buffer types that can be
+ // bound to a bind instance. In most cases, these map directly to
+ // SQLT_XXX codes, identifying an external OCI type. nstring and nclob
+ // however have no equivalent OCI typecode. These additional identifiers
+ // allow for a consistent interface across all types. Note that these
+ // values are mapped to their corresponding external OCI typecodes (if
+ // any) using their integer values, and should therefore not be
+ // rearranged or explicitly assigned without also adjusting the
+ // sqlt_lookup array in odb/oracle/statement.cxx.
+ //
+ enum buffer_type
+ {
+ integer, // Buffer is an integer type of size specified by size.
+ uinteger, // Buffer is an unsigned integer of size specified by
+ // size.
+ binary_float, // Buffer is a float.
+ binary_double, // Buffer is a double.
+ number, // Buffer is a variable length char array.
+ date, // Buffer is a 7-byte char array.
+ timestamp, // Buffer is a variable length char array.
+ string, // Buffer is a variable length char array.
+ nstring, // Buffer is a variable length char array.
+ blob, // Bind is a callback.
+ clob, // Bind is a callback.
+ nclob, // Bind is a callback.
+ last // Used as an end of list marker.
+ };
+
+ buffer_type type; // The type stored by buffer. This must be an external
+ // OCI type identifier of the form SQLT_XXX.
+ 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 result
+ // callbacks are in use, 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.
lob_callback callback;