[Gambas-user] sqlite Error: Query failed: cannot start a transaction within a transaction

Peter Peyotle peterpeyotle at gmx.de
Thu Jul 11 14:16:06 CEST 2019

hello and good day

I use sqlite3 and get the following error: Query failed: can not start a
transaction within a transaction
The error occurs when I use sqlite Transaction. For example:
begin transaction; create table bla bla bla; commit;
For example, if I had already created this table once and overlooked it,
I get an error. Absolutely normal.
If I repeat the statement with a new table name, I get the error above:
Query failed: can not start a transaction within a transaction
I researched but did not really find anything.
For the test, I ended the connection to the database and restarted. No
more problems.
I then noticed that sqlite does not seem to stop the transaction when
the error occurs, ignoring the "commit" and keeping the transaction open.
Or in general: If an error occurs in a statement of a transaction, the
transaction is not terminated. It is stopped before the commit and the
transaction remains open.
If I execute a hconn.execute ("commit;") after the failed creation of
the table, every further transaction is possible.
So far I would have solved that. But somehow unsatisfactory and not elegant.
Now my question:
Is there a way in sqlite to catch an error (such as the one described)
and then automatically stop the transaction?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190711/7e20a843/attachment.html>

More information about the User mailing list