Op 24-mrt-2011, om 13:28 heeft Igor Tandetnik het volgende geschreven: > Jaco Breitenbach <jjbreitenb...@gmail.com> wrote: >> Is there an easy way to permanently disable the default AutoCommit >> using the >> C API? The nature of my application is such that I don't know >> exactly where >> a new transaction begins. Records are inserted into the database, >> and at >> the end an explicit COMMIT is requested. > > Can't you just exectue an explicit BEGIN at the start, just as you > exectue COMMIT at the end? > -- > Igor Tandetnik Hi,
There are cases when you can not expect explicit BEGIN statements, like in the python-sqlite wrapper. The common DB interface specification requires an automatic BEGIN here. The current wrapper injects this before the first DML startement that it encounters in each transaction. It uses strcmp to determnine the statement type, which works satisfactorily though not full proof. The most straight forward solution is to call sqlite3_get_autocommit before each execute step and do a BEGIN first if this returns true. The disadvanatage is that also queries cause a transaction. But it is straightforward and you do not need to know about statement types and their effect on transactions. Edzard Pasma. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users