Hi, thanks, it works!
Van: K. P. [mailto:[email protected]] Verzonden: dinsdag 26 november 2013 01:18 Aan: [email protected] 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: [email protected] To: [email protected] 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 [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
