SOCI / soci

Official repository of the SOCI - The C++ Database Access Library
http://soci.sourceforge.net/
Boost Software License 1.0
1.37k stars 472 forks source link

Sqlite3 get_affected_rows() does not work #1067

Closed wakille closed 10 months ago

wakille commented 10 months ago

Hello, when using soci with the sqlite3 backend, I ran in following issue: get_affected_rows() always returns 0.

soci::statement st = (sql.prepare << "UPDATE v_generic_values SET generic_value='" << generic_value << "' WHERE var_id='" << var_id << "'"); st.execute(true); auto debug = st.get_affected_rows()

From my perspective this looks like a bug. I also found the still open bug report #725 from 2019 concerning this issue.

Thanks!

zann1x commented 10 months ago

I really don't understand when this issue should arise (which it seemingly does) because I can neither reproduce it locally nor do the existing tests (https://github.com/SOCI/soci/blob/924d990f8f4b253e9f7897c92dccfd4c814f569e/tests/common-tests.h#L4806L-L4891) seem to catch such behavior. Even executing the exact same code from #725 doesn't fail on my machine. It would be great if you could try to dig into the issue yourself and share your findings back here!

wakille commented 10 months ago

My problem is, that I edit a view and intercept the command with INSTEAD OF. sqlite3_changes() does not support this (https://www.sqlite.org/c3ref/changes.html). So no issue by soci. But maybe consider taking this hint to your documentation.