Browse Source

* Better code documentation for processql, add %OPTIONALWHERE%

git-svn-id: trunk@42299 -
michael 6 years ago
parent
commit
67b711013f
1 changed files with 14 additions and 1 deletions
  1. 14 1
      packages/fcl-web/src/restbridge/sqldbrestschema.pp

+ 14 - 1
packages/fcl-web/src/restbridge/sqldbrestschema.pp

@@ -1079,7 +1079,7 @@ Const
 
 Const
   Wheres = [flWhereKey];
-  Colons = Wheres + [flInsertParams];
+  Colons = Wheres + [flInsertParams,flUpdate];
   UseEqual = Wheres+[flUpdate];
 
 Var
@@ -1178,16 +1178,29 @@ Var
 
 begin
   Result:=aSQL;
+
+  // from tables %FULLWHERE%
   if (aWhere<>'') then
     S:='WHERE '+aWhere
   else
     S:='';
   Result:=StringReplace(Result,'%FULLWHERE%',S,[rfReplaceAll]);
+
+  // from tables WHERE %REQUIREDWHERE%
   if (aWhere<>'') then
     S:=aWhere
   else
     S:='(1=0)';
   Result:=StringReplace(Result,'%REQUIREDWHERE%',S,[rfReplaceAll]);
+
+  // from tables WHERE X=Y %OPTIONALWHERE%
+  if (aWhere<>'') then
+    S:='AND ('+aWhere+')'
+  else
+    S:='';
+  Result:=StringReplace(Result,'%OPTIONALWHERE%',S,[rfReplaceAll]);
+
+  // from tables WHERE X=Y AND %WHERE%
   if (aWhere<>'') then
     S:='('+aWhere+')'
   else