Skip to content

Commit fb38457

Browse files
committed
try to fix the leak problem
1 parent 83cfe55 commit fb38457

8 files changed

+295
-5
lines changed
+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
object formServidor: TformServidor
2+
Left = 0
3+
Top = 0
4+
BorderIcons = [biSystemMenu, biMinimize]
5+
Caption = 'Taligent Servidor'
6+
ClientHeight = 102
7+
ClientWidth = 368
8+
Color = clBtnFace
9+
Font.Charset = DEFAULT_CHARSET
10+
Font.Color = clWindowText
11+
Font.Height = -11
12+
Font.Name = 'Tahoma'
13+
Font.Style = []
14+
OldCreateOrder = False
15+
WindowState = wsMinimized
16+
OnCreate = FormCreate
17+
PixelsPerInch = 96
18+
TextHeight = 13
19+
object lbNome: TLabel
20+
Left = 8
21+
Top = 8
22+
Width = 230
23+
Height = 19
24+
Caption = 'Servidor Taligent Enterprise'
25+
Font.Charset = DEFAULT_CHARSET
26+
Font.Color = clWindowText
27+
Font.Height = -16
28+
Font.Name = 'Tahoma'
29+
Font.Style = [fsBold]
30+
ParentFont = False
31+
end
32+
object SQLConnection: TSQLConnection
33+
ConnectionName = 'BASE'
34+
DriverName = 'DevartInterBase'
35+
GetDriverFunc = 'getSQLDriverInterBase'
36+
KeepConnection = False
37+
LibraryName = 'dbexpida.dll'
38+
LoginPrompt = False
39+
Params.Strings = (
40+
'LocaleCode=0000'
41+
'DriverUnit=DBXDevartInterBase'
42+
43+
'DriverPackageLoader=TDBXDynalinkDriverLoader,DBXCommonDriver120.' +
44+
'bpl'
45+
46+
'DriverAssemblyLoader=Devart.DbxIda.DriverLoader.TCRDynalinkDrive' +
47+
'rLoader,Devart.DbxIda.DriverLoader,Version=1.0.0.5,Culture=neutr' +
48+
'al,PublicKeyToken=09af7300eec23701'
49+
50+
'MetaDataAssemblyLoader=Borland.Data.TDBXInterbaseMetaDataCommand' +
51+
'Factory,Borland.Data.DbxInterBaseDriver,Version=12.0.0.0,Culture' +
52+
'=neutral,PublicKeyToken=91d62ebb5b0d1b1b'
53+
'ProductName=Interbase'
54+
'GetDriverFunc=getSQLDriverInterBase'
55+
'LibraryName=dbexpida.dll'
56+
'VendorLib=gds32.dll'
57+
'Database=C:\enterprise\fbdata\BASE.FDB'
58+
'User_Name=REMOTO'
59+
'Password=r3m0t0'
60+
'SQLDialect=3'
61+
'MaxBlobSize=-1'
62+
'DevartInterBase TransIsolation=ReadCommitted'
63+
'WaitOnLocks=True'
64+
'CharLength=1'
65+
'EnableBCD=True'
66+
'OptimizedNumerics=True'
67+
'LongStrings=True'
68+
'UseQuoteChar=False'
69+
'FetchAll=False'
70+
'DeferredBlobRead=False'
71+
'DeferredArrayRead=False'
72+
'UseUnicode=False'
73+
'Trim Char=True')
74+
VendorLib = 'gds32.dll'
75+
AfterConnect = SQLConnectionAfterConnect
76+
AfterDisconnect = SQLConnectionAfterDisconnect
77+
Left = 176
78+
Top = 8
79+
end
80+
object SQLMonitor: TSQLMonitor
81+
SQLConnection = SQLConnection
82+
Left = 96
83+
Top = 8
84+
end
85+
object tmrClose: TTimer
86+
Enabled = False
87+
Interval = 61440
88+
OnTimer = tmrCloseTimer
89+
Left = 272
90+
Top = 16
91+
end
92+
end
+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
object formServidor: TformServidor
2+
Left = 0
3+
Top = 0
4+
BorderIcons = [biSystemMenu, biMinimize]
5+
Caption = 'Taligent Servidor'
6+
ClientHeight = 56
7+
ClientWidth = 257
8+
Color = clBtnFace
9+
Font.Charset = DEFAULT_CHARSET
10+
Font.Color = clWindowText
11+
Font.Height = -11
12+
Font.Name = 'Tahoma'
13+
Font.Style = []
14+
OldCreateOrder = False
15+
WindowState = wsMinimized
16+
OnCreate = FormCreate
17+
PixelsPerInch = 96
18+
TextHeight = 13
19+
object lbNome: TLabel
20+
Left = 8
21+
Top = 8
22+
Width = 230
23+
Height = 19
24+
Caption = 'Servidor Taligent Enterprise'
25+
Font.Charset = DEFAULT_CHARSET
26+
Font.Color = clWindowText
27+
Font.Height = -16
28+
Font.Name = 'Tahoma'
29+
Font.Style = [fsBold]
30+
ParentFont = False
31+
end
32+
object SQLConnection: TSQLConnection
33+
ConnectionName = 'BASE'
34+
DriverName = 'DevartInterBase'
35+
GetDriverFunc = 'getSQLDriverInterBase'
36+
KeepConnection = False
37+
LibraryName = 'dbexpida.dll'
38+
LoginPrompt = False
39+
Params.Strings = (
40+
'LocaleCode=0000'
41+
'DriverUnit=DBXDevartInterBase'
42+
43+
'DriverPackageLoader=TDBXDynalinkDriverLoader,DBXCommonDriver120.' +
44+
'bpl'
45+
46+
'DriverAssemblyLoader=Devart.DbxIda.DriverLoader.TCRDynalinkDrive' +
47+
'rLoader,Devart.DbxIda.DriverLoader,Version=1.0.0.5,Culture=neutr' +
48+
'al,PublicKeyToken=09af7300eec23701'
49+
50+
'MetaDataAssemblyLoader=Borland.Data.TDBXInterbaseMetaDataCommand' +
51+
'Factory,Borland.Data.DbxInterBaseDriver,Version=12.0.0.0,Culture' +
52+
'=neutral,PublicKeyToken=91d62ebb5b0d1b1b'
53+
'ProductName=Interbase'
54+
'GetDriverFunc=getSQLDriverInterBase'
55+
'LibraryName=dbexpida.dll'
56+
'VendorLib=gds32.dll'
57+
'Database=C:\enterprise\fbdata\BASE.FDB'
58+
'User_Name=REMOTO'
59+
'Password=r3m0t0'
60+
'SQLDialect=3'
61+
'MaxBlobSize=-1'
62+
'DevartInterBase TransIsolation=ReadCommitted'
63+
'WaitOnLocks=True'
64+
'CharLength=1'
65+
'EnableBCD=True'
66+
'OptimizedNumerics=True'
67+
'LongStrings=True'
68+
'UseQuoteChar=False'
69+
'FetchAll=False'
70+
'DeferredBlobRead=False'
71+
'DeferredArrayRead=False'
72+
'UseUnicode=False'
73+
'Trim Char=True')
74+
VendorLib = 'gds32.dll'
75+
AfterDisconnect = SQLConnectionAfterDisconnect
76+
Left = 176
77+
Top = 8
78+
end
79+
object SQLMonitor: TSQLMonitor
80+
SQLConnection = SQLConnection
81+
Left = 96
82+
Top = 8
83+
end
84+
end

SERVIDOR/BASE/__history/uServidor.pas.~1~ SERVIDOR/BASE/__history/uServidor.pas.~10~

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type
1212
lbNome: TLabel;
1313
SQLMonitor: TSQLMonitor;
1414
procedure FormCreate(Sender: TObject);
15+
procedure SQLConnectionAfterDisconnect(Sender: TObject);
1516
private
1617
{ Private declarations }
1718
public
@@ -30,7 +31,6 @@ var
3031
nome, extensao, base: string;
3132
begin
3233

33-
{ fecho se estiver aberto }
3434
if SQLConnection.Connected then
3535
SQLConnection.Close;
3636

@@ -57,4 +57,11 @@ begin
5757

5858
end;
5959

60+
61+
procedure TformServidor.SQLConnectionAfterDisconnect(Sender: TObject);
62+
begin
63+
if SQLConnection.Connected then
64+
SQLConnection.Close;
65+
end;
66+
6067
end.
+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
unit uServidor;
2+
3+
interface
4+
5+
uses
6+
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7+
Dialogs, WideStrings, StdCtrls, DB, SqlExpr, DBXInterBase, DBXDevartInterBase,
8+
ExtCtrls;
9+
10+
type
11+
TformServidor = class(TForm)
12+
SQLConnection: TSQLConnection;
13+
lbNome: TLabel;
14+
SQLMonitor: TSQLMonitor;
15+
tmrClose: TTimer;
16+
procedure FormCreate(Sender: TObject);
17+
procedure SQLConnectionAfterDisconnect(Sender: TObject);
18+
procedure tmrCloseTimer(Sender: TObject);
19+
procedure SQLConnectionAfterConnect(Sender: TObject);
20+
private
21+
{ Private declarations }
22+
public
23+
{ Public declarations }
24+
end;
25+
26+
var
27+
formServidor: TformServidor;
28+
29+
implementation
30+
31+
{$R *.dfm}
32+
33+
procedure TformServidor.FormCreate(Sender: TObject);
34+
var
35+
nome, extensao, base: string;
36+
begin
37+
38+
if SQLConnection.Connected then
39+
SQLConnection.Close;
40+
41+
// { limpo os par�metros }
42+
// SQLConnection.Params.Clear;
43+
44+
{ nome do cliente }
45+
nome := ExtractFileName(ParamStr(0));
46+
extensao := ExtractFileExt (ParamStr(0));
47+
delete(nome, pos(extensao, nome), length(extensao));
48+
nome := uppercase(nome);
49+
50+
// { defino a conex�o }
51+
// SQLConnection.ConnectionName := nome;
52+
53+
{ mudo somente o nome da base }
54+
base := SQLConnection.Params.Values['DataBase'];
55+
base := StringReplace(base, 'BASE', nome, [rfReplaceAll, rfIgnoreCase]);
56+
SQLConnection.Params.Values['DataBase'] := base;
57+
58+
{ abro a conex�o }
59+
// SQLMonitor.Active := True;
60+
SQLConnection.Open;
61+
62+
end;
63+
64+
65+
procedure TformServidor.SQLConnectionAfterConnect(Sender: TObject);
66+
begin
67+
tmrClose.Enabled := false;
68+
tmrClose.Enabled := true;
69+
end;
70+
71+
procedure TformServidor.SQLConnectionAfterDisconnect(Sender: TObject);
72+
begin
73+
if SQLConnection.Connected then
74+
SQLConnection.Close;
75+
end;
76+
77+
procedure TformServidor.tmrCloseTimer(Sender: TObject);
78+
begin
79+
close;
80+
end;
81+
82+
end.

SERVIDOR/BASE/uServidor.dfm

+10-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ object formServidor: TformServidor
33
Top = 0
44
BorderIcons = [biSystemMenu, biMinimize]
55
Caption = 'Taligent Servidor'
6-
ClientHeight = 56
7-
ClientWidth = 257
6+
ClientHeight = 102
7+
ClientWidth = 368
88
Color = clBtnFace
99
Font.Charset = DEFAULT_CHARSET
1010
Font.Color = clWindowText
@@ -72,6 +72,7 @@ object formServidor: TformServidor
7272
'UseUnicode=False'
7373
'Trim Char=True')
7474
VendorLib = 'gds32.dll'
75+
AfterConnect = SQLConnectionAfterConnect
7576
AfterDisconnect = SQLConnectionAfterDisconnect
7677
Left = 176
7778
Top = 8
@@ -81,4 +82,11 @@ object formServidor: TformServidor
8182
Left = 96
8283
Top = 8
8384
end
85+
object tmrClose: TTimer
86+
Enabled = False
87+
Interval = 61440
88+
OnTimer = tmrCloseTimer
89+
Left = 272
90+
Top = 16
91+
end
8492
end

SERVIDOR/BASE/uServidor.pas

+18-1
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ interface
44

55
uses
66
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7-
Dialogs, WideStrings, StdCtrls, DB, SqlExpr, DBXInterBase, DBXDevartInterBase;
7+
Dialogs, WideStrings, StdCtrls, DB, SqlExpr, DBXInterBase, DBXDevartInterBase,
8+
ExtCtrls;
89

910
type
1011
TformServidor = class(TForm)
1112
SQLConnection: TSQLConnection;
1213
lbNome: TLabel;
1314
SQLMonitor: TSQLMonitor;
15+
tmrClose: TTimer;
1416
procedure FormCreate(Sender: TObject);
1517
procedure SQLConnectionAfterDisconnect(Sender: TObject);
18+
procedure tmrCloseTimer(Sender: TObject);
19+
procedure SQLConnectionAfterConnect(Sender: TObject);
1620
private
1721
{ Private declarations }
1822
public
@@ -58,10 +62,23 @@ procedure TformServidor.FormCreate(Sender: TObject);
5862
end;
5963

6064

65+
procedure TformServidor.SQLConnectionAfterConnect(Sender: TObject);
66+
begin
67+
tmrClose.Enabled := false;
68+
tmrClose.Enabled := true;
69+
end;
70+
6171
procedure TformServidor.SQLConnectionAfterDisconnect(Sender: TObject);
6272
begin
6373
if SQLConnection.Connected then
6474
SQLConnection.Close;
6575
end;
6676

77+
procedure TformServidor.tmrCloseTimer(Sender: TObject);
78+
begin
79+
if SQLConnection.Connected then
80+
SQLConnection.Close;
81+
close;
82+
end;
83+
6784
end.

e2.groupproj.local

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<BorlandProject>
33
<Transactions/>
44
<Default.Personality>
5-
<Projects ActiveProject="C:\Users\elies\Documents\GitHub\enterprise\enterprise.dproj"/>
5+
<Projects ActiveProject="C:\Users\elies\Documents\GitHub\enterprise\SERVIDOR\BASE\BASE.dproj"/>
66
</Default.Personality>
77
</BorlandProject>

enterprise.identcache

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)