Re: [Cppcms-users] statement::bind can be deceptive/dangerous
Brought to you by:
artyom-beilis
|
From: <ele...@ex...> - 2012-05-07 08:47:38
|
>> In this case do I have to store all the variables on the function stack >> before passing them to statement? > if you have your elements in a vector/array/json::array(is a vector > itself) you can do this: > http://cppcms.com/sql/cppdb/stat.html#stat_reset This actually brings up another question about transactions. I understand transactions work this way - cppdb::transaction tr(sql) sql << "INSERT INTO ......" << cppdb::exec sql << "INSERT INTO ......" << cppdb::exec tr.commit() What if you can't use the syntatic sugar but have to deal with statements directly? Ive tried cppdb::transaction tr(sql) cppdb::statement st = sql.prepare("..."); st.bind(...) st.bind(...) st.exec() cppdb::statement st2 = sql.prepare("...") st.bind(...) st.exec() tr.commit() This throws an exception saying sqlite3:cannot rollback transaction - SQL statements in progress What's the proper way? |