Hello,
I have an issue with an SQLite 3 database. This database was corrupted but my function doesn't raise an exception when calling an PRAGMA Intigrity check.
Is this expected ?
The code bellow :
function TdtmMain.CleanSQLiteDatabase(const ADatabaseName: string): string;
var
ASQLiteConnection: TSqlite3Dataset;
begin
if not FileExists(ADatabaseName) then
exit;
Result := '';
ASQLiteConnection := TSqlite3Dataset.Create(nil);
try
ASQLiteConnection.FileName := ADatabaseName;
ASQLiteConnection.ExecSQL('BEGIN TRANSACTION;');
try
ASQLiteConnection.ExecSQL('PRAGMA integrity_check;'); //<--- exception should be raised here
ASQLiteConnection.ExecSQL('VACUUM;');
ASQLiteConnection.ExecSQL('REINDEX;');
ASQLiteConnection.ExecSQL('COMMIT;');
Result := '';
except
on e: Exception do
begin
if Assigned(frmSplash) then
frmSplash.lblSynchroError.Caption := e.Message;
ASQLiteConnection.ExecSQL('ROLLBACK');
end;
end;
finally
ASQLiteConnection.Free;
end;
end;