Complementing:

While debugging I found out that the value is converted to string.

So it looks like: not using id? --> double. Using an id with soci::use(id)?
--> std::string.

Anyone knows why this is happening?

Thanks,
Rodrigo


On Wed, Jan 29, 2014 at 3:58 PM, Rodrigo Madera <rodrigo.mad...@gmail.com>wrote:

> 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
>
>
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
soci-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to