Uprava CreateWaitableTimer pri uzavreni timeru (Rootvin)
This commit is contained in:
+28
-10
@@ -3,6 +3,12 @@
|
||||
interface
|
||||
|
||||
uses
|
||||
FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
|
||||
FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
|
||||
FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.VCLUI.Wait,
|
||||
Data.DB, FireDAC.Comp.Client, FireDAC.Comp.UI, FireDAC.Phys.MSSQLDef,
|
||||
FireDAC.Phys.ODBCBase, FireDAC.Phys.MSSQL, FireDAC.DatS,
|
||||
FireDAC.DApt.Intf, FireDAC.DApt, FireDAC.Comp.DataSet, FireDAC.Stan.Consts,
|
||||
System.Generics.Collections,
|
||||
System.SysUtils,
|
||||
WinApi.ActiveX,
|
||||
@@ -23,6 +29,7 @@ type
|
||||
|
||||
TServiceBase = class abstract
|
||||
strict protected
|
||||
FConn: TFDConnection;
|
||||
FDM: TdatMod;
|
||||
public
|
||||
constructor Create (AdmMain: TdatMod); virtual;
|
||||
@@ -65,13 +72,9 @@ uses
|
||||
System.StrUtils,
|
||||
System.Classes,
|
||||
System.RegularExpressions,
|
||||
FireDAC.Stan.Option,
|
||||
FireDAC.Comp.Client,
|
||||
FireDAC.Stan.Param,
|
||||
MVCFramework.FireDAC.Utils,
|
||||
MVCFramework.DataSet.Utils,
|
||||
MVCFramework.Serializer.Commons,
|
||||
FireDAC.Stan.Consts,
|
||||
System.JSON.Builders,
|
||||
System.JSON.Writers,
|
||||
System.JSON.Types,
|
||||
@@ -117,8 +120,16 @@ uses
|
||||
|
||||
destructor TServiceBase.Destroy;
|
||||
begin
|
||||
try
|
||||
if Assigned(FConn) then
|
||||
FConn.Close;
|
||||
finally
|
||||
FConn.Free;
|
||||
end;
|
||||
|
||||
if (FDM<>nil) then
|
||||
FreeAndNil (FDM);
|
||||
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@@ -128,6 +139,13 @@ uses
|
||||
// var s: string;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
if not Assigned(FConn) then
|
||||
begin
|
||||
FConn := TFDConnection.Create (nil);
|
||||
FConn.ConnectionDefName := sqlPoolName;
|
||||
end;
|
||||
|
||||
FDM:= AdmMain;
|
||||
{
|
||||
|
||||
@@ -157,8 +175,8 @@ uses
|
||||
function TServiceBase.NewUUID32: string;
|
||||
var GUID: TGUID;
|
||||
begin
|
||||
CoCreateGuid(GUID);
|
||||
SetLength(Result, 32);
|
||||
CoCreateGuid (GUID);
|
||||
SetLength (Result, 32);
|
||||
StrLFmt(PChar(Result), 32,'%.8x%.4x%.4x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x',
|
||||
[Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3],
|
||||
Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);
|
||||
@@ -167,13 +185,13 @@ uses
|
||||
|
||||
|
||||
|
||||
procedure TServiceBase.DeepCopyList<T>(SourceList, DestList: TObjectList<T>; CopyFunc: TCopyFunction<T>);
|
||||
procedure TServiceBase.DeepCopyList<T> (SourceList, DestList: TObjectList<T>; CopyFunc: TCopyFunction<T>);
|
||||
var i: Integer;
|
||||
begin
|
||||
for i := 0 to SourceList.Count - 1 do
|
||||
begin
|
||||
// Pro každý objekt v seznamu zavoláme funkci, která vrátí jeho kopii
|
||||
DestList.Add(CopyFunc(SourceList[i]));
|
||||
DestList.Add (CopyFunc(SourceList[i]));
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -181,7 +199,7 @@ uses
|
||||
|
||||
function TServiceBase.sanitizeSQLString (s: string): string;
|
||||
begin
|
||||
result:= s.Replace(' ', '').Replace(';', '').Replace('--', '').Replace(' OR', '').Trim;
|
||||
result := s.Replace(' ', '').Replace(';', '').Replace('--', '').Replace(' OR', '').Trim;
|
||||
end;
|
||||
|
||||
|
||||
@@ -192,7 +210,7 @@ uses
|
||||
lQry: TFDQuery;
|
||||
sqlConnX: TFDConnection;
|
||||
begin
|
||||
result:= false;
|
||||
result := false;
|
||||
|
||||
sqlConnX:= TFDConnection.Create(nil);
|
||||
sqlConnX.ConnectionDefName:= sqlPoolName;
|
||||
|
||||
Reference in New Issue
Block a user