Rodrigo Madera
2014-01-29 17:58:24 UTC
TLDR: Using sqlite3 backend, when using soci::use(some_id) the query throws
bad_cast when reaching get<double>().
--------------------------------------------------------
Hello there.
I'm having a bit of a pickle with a very curious error. I'm using sqlite3.
I'm aware of SOCI's limitations on integer conversion, but this rather
strange execution difference induced by a soci::use() statement is puzzling.
If I read a double from table Person:
boost::fusion::vector<int, double> db_tuple;
session << "select id, height from person where id=:1",
soci::into(db_tuple);
All is well and fine.
But if I try to read the height from a specific user using its id, then I
get a bad_cast blown to my face:
int id = 1;
boost::fusion::vector<int, double> db_tuple;
session << "select id, height from person where id=:id",
soci::use(id), soci::into(db_tuple);
}
So basically, if I want a specific ID, the conversion fails at
soci::details::holder::get<T>, which we all know and love, with T=double.
Thanks for any insight on why I can't use my specific ID!!
Rodrigo
bad_cast when reaching get<double>().
--------------------------------------------------------
Hello there.
I'm having a bit of a pickle with a very curious error. I'm using sqlite3.
I'm aware of SOCI's limitations on integer conversion, but this rather
strange execution difference induced by a soci::use() statement is puzzling.
If I read a double from table Person:
boost::fusion::vector<int, double> db_tuple;
session << "select id, height from person where id=:1",
soci::into(db_tuple);
All is well and fine.
But if I try to read the height from a specific user using its id, then I
get a bad_cast blown to my face:
int id = 1;
boost::fusion::vector<int, double> db_tuple;
session << "select id, height from person where id=:id",
soci::use(id), soci::into(db_tuple);
}
So basically, if I want a specific ID, the conversion fails at
soci::details::holder::get<T>, which we all know and love, with T=double.
Thanks for any insight on why I can't use my specific ID!!
Rodrigo