Browse Source

* Smarter handling of DispatchOptions options

git-svn-id: trunk@42278 -
michael 6 years ago
parent
commit
73b365cd30
1 changed files with 8 additions and 1 deletions
  1. 8 1
      packages/fcl-web/src/restbridge/sqldbrestbridge.pp

+ 8 - 1
packages/fcl-web/src/restbridge/sqldbrestbridge.pp

@@ -493,9 +493,16 @@ end;
 
 procedure TSQLDBRestDispatcher.SetDispatchOptions(AValue: TRestDispatcherOptions);
 
+Var
+  DeleteConnection : Boolean;
+
 begin
+  DeleteConnection:=(rdoConnectionInURL in FDispatchOptions) and Not (rdoConnectionInURL in aValue);
   if (rdoConnectionResource in aValue) then
-    Include(aValue,rdoConnectionInURL);
+    if DeleteConnection then // if user disables rdoConnectionInURL, we disable rdoConnectionResource.
+      exclude(aValue,rdoConnectionResource)
+    else // else we include rdoConnectionInURL...
+      Include(aValue,rdoConnectionInURL);
   if FDispatchOptions=AValue then Exit;
   FDispatchOptions:=AValue;
 end;