Add-Ons & Services

Poco::Data Binding SELECT and NULL values

Please post support and help requests here.
Posts: 20
Joined: 01 Apr 2009, 18:32

Re: Poco::Data Binding SELECT and NULL values

Postby Hitnrun » 23 Aug 2012, 19:31

Because I don't know the datatypes of the fields I'm inserting, all databases are dinamically created using a XML schema, and data is imported from a XML file to the database.
So I read all data from XML in an DynamicAny array, parsing the datatype, and gerenate the sql and bind the variables dinamically, without worrying about the data types.
As the table is dinamically gerenated, all fields can be null, and I use an empty DynamicAny to indicate this. But if bind doesn't handle this, I would have to check each field manually to see if it is a void DynamicAny.

This is what my code looks like:

Code: Select all

   typedef map<string, Poco::SharedPtr<Poco::Dynamic::Var> > fields_t;
   fields_t _fields;

Code: Select all

   Poco::Data::Statement stmt(*session);
   stmt << sql;
   for (fields_t::const_iterator i=_fields.begin(); i!=_fields.end(); i++)
      stmt , Poco::Data::Keywords::bind(*i->second);

Return to “Support”

Who is online

Users browsing this forum: Brony83 and 4 guests