[Lazarus] SQLite Vacuum & Error Cannot rollback - no transaction is active

mulcamd mulcamd at hotmail.com
Tue Nov 26 20:54:14 CET 2013


Hi, thanks, it works!

 

Van: K. P. [mailto:platysternon at hotmail.com] 
Verzonden: dinsdag 26 november 2013 01:18
Aan: lazarus at lists.lazarus.freepascal.org
Onderwerp: Re: [Lazarus] SQLite Vacuum & Error Cannot rollback - no
transaction is active

 

As the error message indicates, do:

    SQLite3Connection.ExecuteDirect('Begin Transaction');    
 
after the vacuum and you should be fine. Works for me.     
 

  _____  

From: mulcamd at hotmail.com
To: lazarus at lists.lazarus.freepascal.org
Date: Mon, 25 Nov 2013 09:31:24 +0100
Subject: [Lazarus] SQLite Vacuum & Error Cannot rollback - no transaction is
active

At the end of some database maintenance where I drop several tables I want
to Vacuum the SQLite database.

 

I use the code below and this works fine, however when I close the program I
get the error:

"Project project1 raised exception class 'EDatabaseError' with message:

Cannot rollback - no transaction is active.

 

Question: how can I Vacuum the database and close the program without
errors?

 

The code (which gives no error when run):

procedure TForm1.VacuumButtonClick(Sender: TObject);

begin

                SQLite3Connection.DatabaseName:='A.db';

                SQLTransaction1.Database:=SQLite3Connection;

                SQLite3Connection.Open;

 

                // Statement below must be issued, otherwise I get error
"cannot VACUUM from within a transaction"

                SQLite3Connection.ExecuteDirect('End Transaction');  // End
the transaction started by SQLdb

                SQLite3Connection.ExecuteDirect('Vacuum');

end;

 

Exit procedure which give the error message.

procedure TForm1.ExitMenuItemClick(Sender: TObject);

begin

     Application.terminate;

end;

 

BTW, when hitting the "break" button the cursor jumps to line 4828 "
inherited Destroy;" within the  "destructor TControl.Destroy;" in
"control.inc".

I run on Windows 7 32 bits and use Lazarus 1.0.12 and FPC 2.6.2


-- _______________________________________________ Lazarus mailing list
Lazarus at lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131126/18a9a01c/attachment-0003.html>


More information about the Lazarus mailing list