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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131125/b8bfb796/attachment.html>
