On Fri, 7 Feb 2020 20:47:56 +0000 Andrew Grafham <andrew.graf...@gmail.com> wrote:
AG> Should it be possible to do the following but with std::string instead of AG> int? (Example taken from here - AG> http://soci.sourceforge.net/doc/release/3.2/statements.html ) I'm not completely sure, to be honest, but I think that ideally it should be, especially if it works for the backends other than ODBC. AG> // Example 3. AG> void fill_ids(std::vector<std::string>& ids) AG> { AG> for (std::size_t i = 0; i < ids.size(); ++i) AG> ids[i] = std::to_string(i); // mimics source of a new ID AG> } AG> AG> const int BATCH_SIZE = 25; AG> std::vector<std::string> ids(BATCH_SIZE); AG> AG> statement st = (sql.prepare << AG> "insert into numbers(value) values(:val)", AG> use(ids)); AG> for (int i = 0; i != 4; ++i) AG> { AG> fill_ids(ids); AG> st.execute(true); AG> } AG> AG> In the ODBC backend, it seems to not bind directly to the strings, and at AG> prepare time it copies the string data into a buffer, which isn't AG> refreshed. It's not really obvious, however, how to fix this, i.e. at which time should the data passed to ODBC be updated. I guess it needs to be done before (every) call to execute() somehow. Regards, VZ
pgpXSSq_mhPcR.pgp
Description: PGP signature
_______________________________________________ soci-users mailing list soci-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/soci-users