From b35e870f4cd7e873f711f30a773ee82c3fd0c428 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Tue, 27 Sep 2011 13:38:27 +0200 Subject: Add sanity check for integer buffer capacity in OCI versions earlier than 11.2 --- odb/oracle/statement.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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, -- cgit v1.1