#1 2021-08-01 12:12:06

racosa
Member
Registered: 2020-12-30
Posts: 2

SQLDBConnectionProperties locks the file

var
   db: TSQLDBConnectionProperties;
   rows: ISQLDBRows;
begin
db := TSQLDBSQLite3ConnectionProperties.Create( 'Base.sql', '', '', '');

  rows := db.ExecuteInlined('SELECT * FROM info', true);

 if rows<>nil then

    begin

      while rows.Step do

        begin

         Writeln( rows.ColumnString('url') );

        end;
    end;

 TFile.Delete( 'Base.sql' ); // error
end;

When I try to delete the "Base.sql", I get the error :

ScreenShot
ScreenShot2

How unlock base ?

db.Free;

Does not help

Last edited by racosa (2021-08-01 12:20:46)

Offline

#2 2021-08-01 13:16:26

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: SQLDBConnectionProperties locks the file

Please read the documentation about mixing ISQLDBRows and connection in the same function.
https://synopse.info/files/html/Synopse … l#TITL_195

The ISQLDBRows instance is not released before the  db.Free is called, so the DB file is still open due to the connection.

Offline

Board footer

Powered by FluxBB