* Free cached queries when committing

This commit is contained in:
Michaël Van Canneyt 2022-12-20 14:53:44 +01:00
parent 3c2ab09a48
commit c34eedb9cf
2 changed files with 18 additions and 0 deletions
packages/fpindexer/src

View File

@ -35,6 +35,7 @@ type
function InsertLanguage(const ALanguage: UTF8String): int64; override;
function CreateConnection: TSQLConnection; override;
function GetID(TableType: TIndexTable): int64;
procedure CommitTrans; override;
procedure FinishCreateTable(const TableType: TIndexTable); override;
procedure FinishDropTable(const TableType: TIndexTable); override;
end;
@ -60,6 +61,17 @@ begin
end;
end;
procedure TPGIndexDB.CommitTrans;
Var
Tbl : TIndexTable;
begin
for Tbl in TIndexTable do
FreeAndNil(FGenQuery[Tbl]);
inherited CommitTrans;
end;
function TPGIndexDB.InsertLanguage(const ALanguage: UTF8String): int64;
var
Q: TSQLQuery;

View File

@ -147,6 +147,8 @@ function TSQLDBIndexDB.GetWordID(const AWord: UTF8String): int64;
var
Q: TSQLQuery;
begin
if aWord='Just' then
Writeln('here');
if (FLastWord = AWord) then
Result := FLastWordID
else
@ -368,7 +370,11 @@ begin
end;
procedure TSQLDBIndexDB.CommitTrans;
Var
T : TCachedQueryType;
begin
For T:=Low(TCachedQueryType) to High(TCachedQueryType) do
FreeAndNil(FQueries[T]);
FDB.Transaction.Commit;
end;