Hi,

Should it be possible to do the following but with std::string instead of
int? (Example taken from here -
http://soci.sourceforge.net/doc/release/3.2/statements.html )

// Example 3.
void fill_ids(std::vector<std::string>& ids)
{
   for (std::size_t i = 0; i < ids.size(); ++i)
      ids[i] = std::to_string(i); // mimics source of a new ID
}

const int BATCH_SIZE = 25;
std::vector<std::string> ids(BATCH_SIZE);

statement st = (sql.prepare <<
                "insert into numbers(value) values(:val)",
                use(ids));
for (int i = 0; i != 4; ++i)
{
    fill_ids(ids);
    st.execute(true);
}

In the ODBC backend, it seems to not bind directly to the strings, and at
prepare time it copies the string data into a buffer, which isn't
refreshed. So repeated calls to "execute" inserts the same data again, Is
this a known issue? Or am I doing something wrong?

Thanks

Andy
_______________________________________________
soci-users mailing list
soci-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to