You are not logged in.
Pages: 1
Hi!
Open a SQLite databse file, read data, close.
Until not quit from program, the SQLite db file not move or delete.
aProp := TSQLDBSQLite3ConnectionProperties.Create(StringToUtf8(eDbName.Text), '', '', '');
aSynDb := ToDataSet(nil, aProp.ExecuteInlined('select * from vwTermenySor WHERE RS_Id IS NULL', true));
....
aProp.MainConnection.Disconnect;
aProp.MainSQLite3DB.DBClose;
aProp.Free;
How can I release SQLite db file completely?
Thx, CSaba
Offline
aProp.Free DOES release the SQLite3 file, without any need of calling Disconnect or DBClose.
There is something wrong with your code.
Are you sure you release the ISQLDBRows instance as returned by aProp.ExecuteInlined?
RTFM at http://synopse.info/files/html/Synopse% … #TITLE_173
Here is some code which proves the fact:
program sqlite3syndbclose;
{$APPTYPE CONSOLE}
uses
FastMM4,
SysUtils,
SynCommons,
SynSQLite3Static,
SynDB,
SynDBSQLite3;
procedure Test;
var props: TSQLDBSQLite3ConnectionProperties;
rows: ISQLDBRows;
begin
props := TSQLDBSQLite3ConnectionProperties.Create('d:\dev\lib\sqlite3\exe\testsql3.db3','','','');
rows := props.Execute('select * from dddtest',[]);
Assert(rows.Step);
Readln; // here we CAN'T delete the file
rows := nil;
props.Free;
end;
begin
Test;
Readln; // here we CAN delete the file
end.
Offline
Many, many thanks! Work it!
My fault, not released the ISQLDBRows instance!
Offline
Pages: 1