[Gambas-user] sqlite Error: Query failed: cannot start a transaction within a transaction
Benoît Minisini
g4mba5 at gmail.com
Thu Jul 11 15:14:18 CEST 2019
Le 11/07/2019 à 14:16, Peter Peyotle a écrit :
> 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?
>
> Peter
>
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
You must rollback your transaction when there is an error.
--
Benoît Minisini
More information about the User
mailing list