* Better code documentation for processql, add %OPTIONALWHERE%

git-svn-id: trunk@42299 -
This commit is contained in:
michael 2019-06-27 16:13:55 +00:00
parent 2aaae5353e
commit 67b711013f

View File

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