On Thu, Jun 2, 2016 at 2:42 PM, Clemens Ladisch <clem...@ladisch.de> wrote:
> Gelin Yan wrote: > >> In Process A > >> > >> insert a value into a table XX and commit. > >> > >> In Process B > >> > >> select from the same table XX > >> > >> and I didn't find the inserted record. > > > > I used python & its sqlite3 module for this trial, the autocommit mode > > is default on. After I explicitly called "BEGIN" & "COMMIT" for selecting > > record, I could see the inserted record. > > If you have not explicitly called BEGIN, SQLite automatically wraps each > statement in a transaction. So in theory, the behaviour with and without > BEGIN/COMMIT should be the same. > > Python tries to be clever and automatically makes hidden calls to BEGIN/ > COMMIT before certain SQL statements. (It's broken: the DML/DDL > detection does not work correctly in a lot of corner cases.) > > The autocommit mode (which disables Python's braindamage) is _not_ > enabled by default, and the behaviour of the database shows that it is > indeed not enabled. So I guess you have to enable it explicitly (for > every connection object): > < > https://docs.python.org/2/library/sqlite3.html#sqlite3-controlling-transactions > > > > > Regards, > Clemens > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > Hi Clemens Yes, I have verified by using the c-api directly, the python sqlite module looks weird. Now I am using transaction explicitly. Thanks. Regards gelin yan _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users