Permalink
Browse files

fixed x_integer handling for 64-bit

DB2 (erroneously?) assumes a SQL_C_LONG is a 32-bit integer and
defines SQLINTEGER accordingly.  Since a long integer is likely 64
bits on a 64-bit platform, using 'SQLINTEGER' instead of 'long' makes
more sense.
  • Loading branch information...
toonen committed Aug 17, 2012
1 parent 8fe4028 commit 3cad1c8779aeb89120363038fefde2f1bf9b2177
Showing with 6 additions and 6 deletions.
  1. +1 −1 src/backends/db2/standard-into-type.cpp
  2. +5 −5 src/backends/db2/vector-into-type.cpp
@@ -49,7 +49,7 @@ void db2_standard_into_type_backend::define_by_pos(
break;
case x_integer:
cType = SQL_C_SLONG;
size = sizeof(long);
size = sizeof(SQLINTEGER);
break;
case x_long_long:
cType = SQL_C_SBIGINT;
@@ -52,9 +52,9 @@ void db2_vector_into_type_backend::define_by_pos(
case x_integer:
{
cType = SQL_C_SLONG;
size = sizeof(long);
std::vector<long> *vp = static_cast<std::vector<long> *>(data);
std::vector<long> &v(*vp);
size = sizeof(SQLINTEGER);
std::vector<SQLINTEGER> *vp = static_cast<std::vector<SQLINTEGER> *>(data);
std::vector<SQLINTEGER> &v(*vp);
prepare_indicators(v.size());
data = &v[0];
}
@@ -287,7 +287,7 @@ void db2_vector_into_type_backend::resize(std::size_t sz)
break;
case x_integer:
{
std::vector<long> *v = static_cast<std::vector<long> *>(data);
std::vector<SQLINTEGER> *v = static_cast<std::vector<SQLINTEGER> *>(data);
v->resize(sz);
}
break;
@@ -353,7 +353,7 @@ std::size_t db2_vector_into_type_backend::size()
break;
case x_integer:
{
std::vector<long> *v = static_cast<std::vector<long> *>(data);
std::vector<SQLINTEGER> *v = static_cast<std::vector<SQLINTEGER> *>(data);
sz = v->size();
}
break;

0 comments on commit 3cad1c8

Please sign in to comment.