aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-10-14 13:31:41 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-10-14 13:35:53 +0200
commitc4c7df8d37d4614b525a8dfd4fda1f1d519c97bf (patch)
tree4b71fd49620ef445e46421295ce07c0c9987c132
parentad7545cf9e795d7af0440fd3b5ab2eef075b539f (diff)
Create separate OCI buffer type lookups for parameter and result buffers
This is required due to the asymmetric manner in which LOB types are persisted to and loaded from the database.
-rw-r--r--odb/oracle/statement.cxx32
1 files changed, 26 insertions, 6 deletions
diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx
index 8435d1f..3de8619 100644
--- a/odb/oracle/statement.cxx
+++ b/odb/oracle/statement.cxx
@@ -23,10 +23,30 @@ namespace odb
{
namespace oracle
{
- // Mapping of bind::buffer_type values to there equivalent external
- // OCI typecode identifiers.
+ // Mapping of bind::buffer_type values for parameter buffers to their
+ // equivalent external OCI typecode identifiers.
//
- static ub4 sqlt_lookup[bind::last] =
+ static ub4 param_sqlt_lookup[bind::last] =
+ {
+ SQLT_INT, // bind::integer
+ SQLT_UIN, // bind::uinteger
+ SQLT_BFLOAT, // bind::binary_float
+ SQLT_BDOUBLE, // bind::binary_double
+ SQLT_VNU, // bind::number
+ SQLT_DAT, // bind::date
+ SQLT_TIMESTAMP, // bind::timestamp
+ SQLT_CHR, // bind::string
+ SQLT_CHR, // bind::nstring
+ SQLT_BIN, // bind::raw
+ SQLT_LBI, // bind::blob
+ SQLT_LNG, // bind::clob
+ SQLT_LNG // bind::nclob
+ };
+
+ // Mapping of bind::buffer_type values for result buffers to their
+ // equivalent external OCI typecode identifiers.
+ //
+ static ub4 result_sqlt_lookup[bind::last] =
{
SQLT_INT, // bind::integer
SQLT_UIN, // bind::uinteger
@@ -156,7 +176,7 @@ namespace odb
o,
b->buffer,
static_cast<sb4> (b->capacity),
- sqlt_lookup[b->type],
+ param_sqlt_lookup[b->type],
b->indicator,
b->size,
0,
@@ -240,7 +260,7 @@ namespace odb
i,
lob,
sizeof (OCILobLocator*),
- sqlt_lookup[b->type],
+ result_sqlt_lookup[b->type],
b->indicator,
0,
0,
@@ -288,7 +308,7 @@ namespace odb
i,
b->buffer,
static_cast<sb4> (b->capacity),
- sqlt_lookup[b->type],
+ result_sqlt_lookup[b->type],
b->indicator,
b->size,
0,