Bonjour,

Je fais une requête (sur une base SQLite).
Tout fonctionne correctement, par contre, à la fermeture de l'application, un message m'informe qu'un objet n'a pas été libéré.
Cela correspond à l'objet p := TParam.Create(qry.Params, ptInput);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function TestSQL: String;
var
  qry: TSQLQuery;
  p: TParam;
  i: Integer;
begin
  Result := '';
 
  Datas1.SQLite3Connection1.DatabaseName := DB_NAME;
  Datas1.SQLite3Connection1.Connected    := True;
  Datas1.SQLTransaction1.DataBase := Datas1.SQLite3Connection1;
  Datas1.SQLTransaction1.Active   := True;
 
  qry := TSQLQuery.Create(nil);
  qry.DataBase := Datas1.SQLite3Connection1;
  qry.SQL.Text := Format('SELECT * FROM %s WHERE code like :code '
                         ,[TBL_DEVISES]);
 
  p := TParam.Create(qry.Params, ptInput);
  p.Name := 'code';
  qry.Params.AddParam(p);
 
  qry.ParamByName('code').AsString := 'EUR';
 
  try
    qry.Open;
    if (not qry.EOF) then
      Result := qry.FieldByName('CODE').AsString + ' : ' + qry.FieldByName('NOM').AsString;
  finally
    for i:=0 to Pred(qry.Params.Count) do
      qry.Params.Items[i].Free;
 
    FreeAndNil(qry);
  end;
end;
Comment libérer proprement le ou les TParams ?