xtool/contrib/mORMot/SQLite3/Samples/ThirdPartyDemos/Migajek/synopse-sqlite-demo/uQueryHistory.pas

41 lines
691 B
ObjectPascal

unit uQueryHistory;
interface
uses
SynCommons,
mORMot;
type
TSQLQueryHistory = class(TSQLRecord)
private
fSQL: RawUTF8;
fLastUsed: TDateTime;
published
property SQL: RawUTF8 read fSQL write fSQL;
property LastUsed: TDateTime read fLastUsed write fLastUsed;
public
procedure FillHistory();
end;
implementation
uses SysUtils, uCustomer;
procedure TSQLQueryHistory.FillHistory();
var
fData: TSQLTable;
begin
if globalClient = nil then
exit;
fData:= globalClient.MultiFieldValues(RecordClass, '');
fData.SortFields(fData.FieldIndex('LastUsed'), false, nil, sftDateTime);
fData.OwnerMustFree:= true;
FillPrepare(fData);
end;
end.