Hi, On 27/05/2012 18:12, Vadim Zeitlin wrote: > This is getting somewhat ridiculous but it looks that wherever I look at > ODBC backend code I find a problem. The latest one is in its > odbc_standard_use_type_backend::post_use(): what is the point of > overwriting the *input* parameters with the values we have provided for > ODBC driver ourselves? This doesn't seem to make any sense, this data is > never modified by ODBC to the best of my knowledge (again, we're speaking > about SQL_PARAM_INPUT here), so why should we do this? Does anybody know of > any problems that would happen if post_use() part dealing with data is > simply removed?
Without looking at the code, I remember we had some discussion about dealing with const data. SOCI allows to "use" const values and promises not to modify them, so: const int ci = 7; sql << "insert ...", use(ci); SOCI has to behave properly and has to ensure that ci is never, ever modified in such a case. The problem is that actual backends do not necessarily have separate APIs for const and non-const bindings and therefore SOCI has to do some const_casts (and other_nasty_casts as well) to properly bind with them. We did not trust the backend to really abide by the logical contract (that input data is not modified), especially that it was not fully understood what might happen with *stored procedures* and their in/inout parameters. The only solution we have found was to copy user data to a separate buffer so that the original was guaranteed to be const, no matter what kind of mess the backend would do to the copy. The above is not necessarily true and not necessarily related to the particular place in code you are referring to, but there is a chance that what you see is just the above. Regards, -- Maciej Sobczak * www.msobczak.com * www.inspirel.com ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Soci-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/soci-users
