Skip to content

Commit 50de743

Browse files
committed
Ajustes TMiniRESTSQLQueryDBX
1 parent 0680462 commit 50de743

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: MiniREST.SQL.DBX.pas

+5-3
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ TMiniRESTSQLConnectionDBX = class(TMiniRESTSQLConnectionBase, IMiniRESTSQLConn
7474
TMiniRESTSQLQueryDBX = class(TInterfacedObject, IMiniRESTSQLQuery)
7575
protected
7676
FQry : TSimpleDataSet;
77-
{$HINTS OFF}
78-
FIConnection : IMiniRESTSQLConnection;
79-
{$HINTS ON}
77+
FConnection : IMiniRESTSQLConnection;
8078
FSQL: string;
8179
FParams: TObjectDictionary<string, IMiniRESTSQLParam>;
8280
procedure InternalAddParam(AParam: IMiniRESTSQLParam);
@@ -157,6 +155,7 @@ procedure TMiniRESTSQLQueryDBX.Close;
157155

158156
constructor TMiniRESTSQLQueryDBX.Create(AConnection: IMiniRESTSQLConnection);
159157
begin
158+
FConnection := AConnection;
160159
FQry := TSimpleDataSet.Create(nil);
161160
FQry.DataSet.SQLConnection := TSQLConnection(AConnection.GetObject);
162161
FParams := TObjectDictionary<string, IMiniRESTSQLParam>.Create([]);
@@ -243,6 +242,7 @@ procedure TMiniRESTSQLQueryDBX.Open;
243242
begin
244243
InternalAddParam(LParam);
245244
end;
245+
FConnection.Connect;
246246
FQry.Open;
247247
end;
248248

@@ -287,6 +287,8 @@ procedure TMiniRESTSQLConnectionDBX.Commit;
287287

288288
procedure TMiniRESTSQLConnectionDBX.Connect;
289289
begin
290+
if FSQLConnection.Connected then
291+
Exit;
290292
FSQLConnection.DriverName := FConnectionParams.GetDriverName;
291293
FSQLConnection.LoginPrompt := False;
292294
FSQLConnection.Params.Text := FConnectionParams.GetConnectionString;

0 commit comments

Comments
 (0)