Discussion:
[soci-users] Rowset, tuples, long long, and overflows.
Rodrigo Madera
2013-11-06 11:39:30 UTC
Permalink
I'm having a very strange issue regarding data types using boost tuples.

I need to get a numeric column from the database which holds large values.
Nothing a long long can't handle. In fact, using soci::into() to get the
value for a single given row works perfectly:

db_long my_little_scn;

orm.session() << "select ORA_ROWSCN from table where rowid='something'",
soci::into(my_little_scn);

Since I used the my_little_scn variable explicitly, SOCI was happy and
filled in a nice and juicy number. A big number, I might
add: 11173065616613.


Now let's try the same thing using a boost::tuple. Normally I would have
the tuple hold the entire row's types, but since I wish to pinpoint the
problem, I'll just leave it as a tuple of one element.

--

try {

typedef long long db_long;


// Normally this would hold a full row of types, but I isolated the
problem.

typedef boost::tuple<db_long> my_row_tuple;


soci::rowset<my_row_tuple> rows = (

orm.session().prepare << "select ORA_ROWSCN from table"

);

// Exception at begin()...

auto itr = rows.begin();

}

catch (soci::soci_error& e) {

e.what(); // <-- ORA-01455: converting column overflow integer datatype

}
--

The problem is that it throws an exception. BTW, I''m using Oracle. And the
exception is ORA-01455, which according to a very creepy Oracle expert [1]
is "this variable is too short for such a big number, fool".

So giving this problem some thought, and after having that rapist-look on
my screen for some time, I concluded that SOCI is not "knowing" I gave it a
long long for the data exchange. Soci::into() knew it was a long long.
Maybe the Boost tuple code is believing it's a shorter type, say long.

Could this be? Could the tuple code be crippling my poor long long?

So basically to sum it all up: soci::into(long long) --> OK. Using prepare
and then an iterator --> Not respecting long long.

Thanks for any insights,
Rodrigo


[1]
http://www.dba-oracle.com/t_ora_01455_converting_column_overflow_integer_datatype.htm
Loading...