Hello,

I just started using SOCI, and I have one quick question about casting

Consider this structure:
struct A
{ unsigned long one; unsigned int two; unsigned short three; }

In MySQL, the fields are defined like:
one : INT unsigned
two: SMALLINT unsigned
three: TINYINT unsigned

How am I supposed to cast using the static templated function from_base
the SQL values into my structure?
     static void from_base(values const & v, indicator /* ind */, A& s)
     {
s.one = v.get<unsigned long>("id"); /// Throws std::bad_cast()
     }

Thanks,

nico




------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to