aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-09-27 13:38:27 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-09-27 13:38:27 +0200
commitb35e870f4cd7e873f711f30a773ee82c3fd0c428 (patch)
tree775c1ae5f4cef5380b188659485a6dd52da38f34
parent742cf0608bf8232cf2fc8392a0f70855b0316755 (diff)
Add sanity check for integer buffer capacity in OCI versions earlier than 11.2
-rw-r--r--odb/oracle/statement.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx
index 39ad28c..4e35fe5 100644
--- a/odb/oracle/statement.cxx
+++ b/odb/oracle/statement.cxx
@@ -120,6 +120,16 @@ namespace odb
for (size_t e (o + c); o < e; ++c, ++b)
{
+#if OCI_MAJOR_VERSION < 11 || \
+ (OCI_MAJOR_VERSION == 11 && OCI_MINOR_VERSION < 2)
+ // Assert if a 64 bit integer buffer type is provided and the OCI
+ // version is unable to implicitly convert the NUMBER binary data
+ // to the relevant type.
+ //
+ assert ((b->type != SQLT_INT && b->type != SQLT_UIN) ||
+ b->capacity <= 4);
+#endif
+
OCIBind* h (0);
sword r (OCIBindByPos (stmt_,
&h,
@@ -199,6 +209,16 @@ namespace odb
}
else
{
+#if OCI_MAJOR_VERSION < 11 || \
+ (OCI_MAJOR_VERSION == 11 && OCI_MINOR_VERSION < 2)
+ // Assert if a 64 bit integer buffer type is provided and the OCI
+ // version is unable to implicitly convert the NUMBER binary data
+ // to the relevant type.
+ //
+ assert ((b->type != SQLT_INT && b->type != SQLT_UIN) ||
+ b->capacity <= 4);
+#endif
+
OCIDefine* h (0);
sword r (OCIDefineByPos (stmt_,
&h,